News for hackers. Stuff that matters.
Re:JerryScript – A JavaScript Engine for Internet of Things by Animats on Sunday July 26, 2015 @02:33PM (#9951806)
Nice. JavaScript allocates a lot of memory dynamically, and sometimes implicitly, though. In very tiny RAM environments, that's going to be a problem.
Re:JerryScript – A JavaScript Engine for Internet of Things by weland on Sunday July 26, 2015 @03:54PM (#9952014)
It would probably be OK if all programs have a simple, predictable sequence of malloc and free that they call in a loop, with similar-ish sizes each time.

It's extremely unpleasant to program something with just a few KB of RAM and not know exactly what memory goes where. However, a lot of IoT-related gadgets just gather a buffer of data from an ADC or something, average it and send it over some wireless protocol every 1 minute. The allocation pattern is predictable enough that you don't run into strange cornercases.

I see no reason why anyone would want to use this commercially, but for the enthusiast market (and maybe even for some rapid prototyping) this looks interesting enough.

Re:JerryScript – A JavaScript Engine for Internet of Things by mwcampbell on Sunday July 26, 2015 @05:36PM (#9952272)
It seems to me that consistent allocation patterns would help more if JerryScript used reference counting for memory management, perhaps with mark-and-sweep GC as a backup to handle cycles. As it stands now, each object has a reference count to keep it alive while it's being used by C code via the API, but actual deallocation is done via mark-and-sweep GC.
Re:JerryScript – A JavaScript Engine for Internet of Things by arez on Sunday July 26, 2015 @03:15PM (#9951917)
had the same thought, why do I have to do everything with JS, sometimes I think it's only to satisfy "Atwoods Law" again and again :) would do it in Go lang, not as raw as C but good and up to date enough for this purpose.
Re:JerryScript – A JavaScript Engine for Internet of Things by Animats on Sunday July 26, 2015 @03:48PM (#9952000)
JerryScript needs 64 KB RAM, 200KB ROM. So what can it run on?

    Ardunino Uno (ATmega CPU): 2KB RAM, 32KB ROM  - Too small.
    Arduino DUE (ARM CPU):    96KB RAM, 512KB ROM - Yes.
    Raspberry Pi (ARM CPU):  256MB RAM, 1GB+ ROM  - Yes, but why?
On the Raspberry Pi, of course, you can run Go programs. Or anything else that runs on Linux. It won't fit on the smaller machines. There's no need to run a Javascript this tiny on the Pi.

So the target for JerryScript is machines in the Due range. Rust has been crammed into the Arduino Due, which may become a good approach for embedded work. Go probably won't fit; too much runtime.

They're all in the $25-$45 price range. The Due, surprisingly, is the most expensive.

Re:JerryScript – A JavaScript Engine for Internet of Things by gbl08ma on Sunday July 26, 2015 @04:05PM (#9952045)
The ESP8266 may be a good candidate. tmrmr already said in these comments that some other company had ported another JS engine to the thing. And the world isn't just Arduinos, Raspberry Pis and other nicely-packaged "hacking" solutions.
Re:JerryScript – A JavaScript Engine for Internet of Things by rhinoceraptor on Sunday July 26, 2015 @07:10PM (#9952542)
Yep, I've been running Node.js on a Raspberry Pi with Arch Linux ARM embedded project for a couple months now. It works great, other than the startup time for Node being pretty rough.
Re:JerryScript – A JavaScript Engine for Internet of Things by bsder on Monday July 27, 2015 @12:09AM (#9953282)
> Ardunino Uno (ATmega CPU): 2KB RAM, 32KB ROM - Too small.

To be fair, that system really doesn't run anything dynamic well.

However, your point stands. Requiring 64K of RAM puts this above most ARM Cortex M0 chips.

Picobit (https://github.com/stamourv/picobit) sits comfortably in 16K ROM/4K RAM. There's no good reason why Javascript vouldn't do the same.

Re:JerryScript – A JavaScript Engine for Internet of Things by MikusR on Sunday July 26, 2015 @04:29PM (#9952114)
Re:JerryScript – A JavaScript Engine for Internet of Things by dottrap on Sunday July 26, 2015 @10:51PM (#9953095)
Raspbian, the default OS for Raspberry Pi, actually includes JavaScriptCore as a standard, pre-installed component.