Duktape
jerryscript
Our great sponsors
Duktape | jerryscript | |
---|---|---|
3 | 8 | |
5,238 | 6,219 | |
- | 0.8% | |
8.0 | 8.9 | |
23 days ago | about 2 months ago | |
JavaScript | C | |
MIT License | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Duktape
-
Optimizations Enabled by -ffast-Math
Fast math optimizations can break code like this by breaking isNaN.
I was porting a C++ project to a certain platform - and that platform enabled a -ffast-math equivalent by default in Release (but not Debug) builds! This broke duktape, a JS engine said project embedded, in some nasty and subtle ways. Instead of storing a number/pointer/??? (8 bytes) + type tag (4? bytes) for each dynamically typed JS value, duktape can bit-pack values into a single 8 byte "double" value by storing object/string handles as NaN values - this isn't an uncommon trick for dynamically typed scripting stuff:
https://github.com/svaarala/duktape/blob/c3722054ea4a4e50f48...
Naturally, the -ffast-math equivalent broke isNaN checks, which caused random object/string handles to be mistakenly reinterpreted as "numbers" - but only in Release builds, for this one particular platform, in one rarely taken branch, so neither QA nor CI caught it, leading to hours of manufacturing a repro case, stepping through an absurd amount of code, and then finally looking at the default build rules and facepalming.
Cursing the platform vendor under my breath, I overrode the defaults to align with the defaults of every other config x platform combination we already had: no fast math. If you want those optimizations, use SSE-friendly NaN-avoiding intrinsics - or, if you must use the compiler flags, ensure you do so consistently across build configs and platforms, perhaps limited to a few TUs or modules if possible. This allows you to have a chance at using your Debug builds to debug the resulting "optimizations".
-
Can C++ and JS be used together?
Sure. For example, DukTape is an implementation of Javascript designed to be embedded in other projects. Google's V8 Javascript engine (used in Chrome), can also be embedded, see Node.Js for example.
-
[AskJS] Do you use JavaScript on Microcontrollers? Which engine / interpreter?
- Duktape (4.8k stars)
jerryscript
-
Kaluma - tiny JavaScript runtime for microcontrollers - includes a browser-based IDE that can communicate with a Raspberry Pi Pico and other RP2040 boards via Web Serial API. Write code in the browser (in JavaScript), then copy and run it on the board with a click of a button.
Based on JerryScript, the creators also provide an IDE and serial communication tool on their website. There's also ample documentation and guides. Looking forward to getting more into this.
-
TypeScript is the Only Programming Language you Need: TypeScript Everywhere
I hear you loud and clear.
-
Can the PineTime Watch stream music without a phone? (Onboard music storage)
There are subsets of JS for embedded device e.g. Espruino https://github.com/espruino/Espruino for BangleJS https://shop.espruino.com/banglejs also with 4MB or JerryScript https://jerryscript.net
-
Txiki.js: Tiny JavaScript runtime built with QuickJS and libuv
Fitbit uses Jerryscript in some of their watch OSes. Well, at least they were last time I was tinkering with making my own watch face
-
[AskJS] Do you use JavaScript on Microcontrollers? Which engine / interpreter?
- JerryScript (5.8k stars)
-
🚀10 Trending projects on GitHub for web developers - 29th January 2021
jerryscript-project / jerryscript
-
JerryScript: Lightweight JavaScript Engine for IoT
Nice comparison of js engines can be found in the issues here https://github.com/jerryscript-project/jerryscript/issues/43...
What are some alternatives?
V8 - The official mirror of the V8 Git repository
Lua - Lua is a powerful, efficient, lightweight, embeddable scripting language. It supports procedural programming, object-oriented programming, functional programming, data-driven programming, and data description.
quickjs - Public repository of the QuickJS Javascript Engine. Pull requests are not accepted. Use the mailing list to submit patches.
MicroPython - MicroPython - a lean and efficient Python implementation for microcontrollers and constrained systems
ChaiScript - Embedded Scripting Language Designed for C++
quickjspp - Port of QuickJS Javascript Engine.
Espruino - The Espruino JavaScript interpreter - Official Repo
SWIG - SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages.
V7 - Embedded JavaScript engine for C/C++
squirrel - Official repository for the programming language Squirrel
ChakraCore - ChakraCore is an open source Javascript engine with a C API. [Moved to: https://github.com/chakra-core/ChakraCore]