@@ -129,29 +129,36 @@ i.e., much closer to the metal.
129129* objects use reference counting
130130* classes are laid out using static type information (like in C), so there is little memory overhead
131131
132- PXT also supports dynamic objects, which are essentially string-to-value
133- hashes - these have much higher memory overhead, and would be typically the only thing available
132+ PXT also supports dynamic objects (also reference counted) , which are essentially string-to-value
133+ mappings - these have much higher memory overhead, and would be typically the only thing available
134134in a dynamic language.
135135
136- This lends itself to significant performance improvements over typical dynamic VM implementations:
137- * code is never in any byte-code form that needs to be interpreted; this results in execution
138- slowdowns of 2-3x compared to compiled C code;
139- typical JS interpreter would be more in the 50x range
140- * there is no RAM overhead for user-code - code all sits in flash; in a dynamic VM
136+ All of this lends itself to significant performance improvements over typical dynamic VM implementations:
137+ * user programs are compiled directly to machine code, and are
138+ never in any byte-code form that needs to be interpreted; this results in execution
139+ 10-20x faster than a typical JS interpreter
140+ * there is no RAM overhead for user-code - all code sits in flash; in a dynamic VM
141141 there are usually some data-structures representing code
142- * due to lack of boxing and static class layout the memory consumption for equivalent program
143- data is within 2x of C code; a dynamic VM would be at least twice that, not counting
144- the user-code structures mentioned above
142+ * due to lack of boxing and static class layout the memory consumption for objects
143+ is around half the one you get in a dynamic VM ( not counting
144+ the user-code structures mentioned above)
145145* while there is some runtime support code in PXT, it's typically around 100KB smaller than
146146 a dynamic VM, bringing down flash consumption and leaving more space for user code
147147
148- Interfacing C++ from PXT is simpler than interfacing typical dynamic VMs,
148+ The execution time, RAM and flash consumption of PXT code is as a rule of thumb 2x of
149+ compiled C code, making it competitive to write drivers and other user-space libraries.
150+
151+ Interfacing C++ from PXT is easier than interfacing typical dynamic VMs,
149152in particular for simple functions with numbers on input and output - there is
150153no need for unboxing, checking types, or memory management.
151154
152155The main disadvantage of using static compilation is lack of dynamic features
153156in the language, as explained above.
154157
158+ While it is possible to run a dynamic VM even on an nRF51-class device
159+ (256KB of flash, 16KB of RAM), it leaves little space for innovative features
160+ on the software side, or more complex user programs and user-space (not C++) drivers.
161+
155162## Smaller int types
156163
157164As noted above, when performing computations numbers are treated as signed 32 bit
0 commit comments