Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
codermike
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
4 ms
·
1.
▲
JavaScript FFI with no glue code
(coder-mike.com)
2 points
by
codermike
4y ago
|
0 comments
2.
▲
by
codermike
4y ago
Yes, the parking meter example is an exact case I ran into in real life. But Microvium didn't exist back then. But in general, an IoT solution may have some business logic or rules that transcends the specific device, and some may pref
3.
▲
by
codermike
4y ago
It calls malloc once or twice when you resume a snapshot. The first malloc includes core persistent state (e.g. memory stats counters, etc), and global variables in the script. If there is any heap in the snapshot, the second malloc is for
4.
▲
by
codermike
4y ago
If by "like this" you mean with snapshotting (e.g. if you prefer snapshotting to bundling https://coder-mike.com/blog/2020/05/15/snapshotting-vs-bundl... ), then node doesn't support it bec
5.
▲
by
codermike
4y ago
Yep! That’s exactly what it does. It uses a compacting garbage collector.
6.
▲
by
codermike
4y ago
By the way, if you’re interested, I’m the guy behind Microvium. It’s been my pet project for the last few years. It’s very motivating to see all the positive and encouraging feedback. Thank you all! You can find me @microvium on twitter
7.
▲
by
codermike
4y ago
I think a proper FFI library should be distributed with Microvium for convenience, but I just haven’t gotten around to it yet. But let me try summarize how snapshotting relates.. The snapshotting paradigm means that your JS code starts exec
8.
▲
by
codermike
4y ago
> The entire purpose of Javascript is that it's a "scripting" language, so having an interactive runtime is kind of the point. If your use case is plugging a keyboard into your MCU or connecting a terminal prompt on the U
9.
▲
by
codermike
4y ago
Here are some use cases... - If you have an IoT device and want to share logic between the device and cloud. A concrete example might be a smart parking meter where you can pay for parking on the meter itself or online or by a mobile app, a
10.
▲
by
codermike
4y ago
Microvium does use a compacting heap, something similar to a semi-space collector except that it can free up the unused "space". Have a look for some of the details: https://coder-mike.com/blog/2020/07&#x
11.
▲
by
codermike
4y ago
The static analysis in Microvium does do this for the stack variables, but the heap is not bounded. It's trivial to write a for-loop or something that creates N new objects.
12.
▲
by
codermike
4y ago
Yes, you make a good point. A decent chunk of the size of an engine like mJS or Elk (or XS) is the parser or bytecode compiler (XS and mJS use a bytecode compiler like Microvium but the compiler is designed to run on-device and so contribut
13.
▲
by
codermike
4y ago
I hadn't heard of Toit. That's very interesting. Moddable's XS engine is great, and covers the full ECMAScript spec. I did a bit of contract work on the XS engine a while back, and I participated for some time as an invited e
14.
▲
I made a JavaScript engine for microcontrollers in just 8.5kB of ROM
(coder-mike.com)
14 points
by
codermike
4y ago
|
4 comments