4 ms·
some of the JavaScript engines, most notably MicroSoft's JavaScript Engine, use reference counting for determining when memory can be freed.[1]. Some implementa
by hershel 13y ago
some of the JavaScript engines, most notably MicroSoft's JavaScript Engine, use reference counting for determining when memory can be freed.[1]. Some implementations of reference counting work well in hard real time systems[2].
So it's too early to tell if espruino would fit real time systems.
And regarding wasted cycles: for this project, it doesn't matter much. Unless you make stuff in volume ,micro controllers are cheap.
[1]http://www.fasterj.com/articles/javascript.shtml http://www.fasterj.com/articles/javascript.shtml
[2]http://liu.diva-portal.org/smash/record.jsf?pid=diva2:20899 http://liu.diva-portal.org/smash/record.jsf?pid=diva2:20899
- exDM69 13y ago> some of the JavaScript engines, most notably MicroSoft's JavaScript Engine, use reference counting for determining when memory can be freed.[1] Interesting, I was unaware of this. How does Microsoft's JavaScript engine deal with cyclic data structures, which reference counting can't deal with? The best I understood from your link is that it just leaks cyclic structures? Does the JS spec really allow this? > So it's too early to tell if espruino would fit real time systems. It's too early to tell but IMO it's a critical aspect of microcontrollers. Many if not most microcontroller applications have some degree of real time requirements, which limits your choices for software runtime systems.
- hershel 13y agoI don't know how MS does solve the cycle problem. Many data structures don't have cycles. I believe it's pretty true for many embedded systems.
- gfwilliams 13y agoEspruino does use reference counting, and currently falls back to proper Garbage Collection if available memory gets filled with cyclic datastructures. Responding to IO is handled and timestamped using interrupts, so if you write your code such that you use the timestamp, you can actually do some very accurate timing. One other good point is (strangely) power usage. As there's an interpreter, it can very easily detect when it isn't doing anything and can go into low power sleep modes - it's something that you can do with another MCU and a lot of effort, but that you get for free with Espruino. There are things it's good for and things it isn't - but for the majority of projects people do with Arduino I think it really does provide value.