7 ms·
Show HN: Elsa – A QuickJS wrapper written in Go
- pjmlp 6y agoN̶i̶c̶e̶ ̶e̶x̶a̶m̶p̶l̶e̶ ̶o̶f̶ ̶a̶c̶t̶u̶a̶l̶ ̶s̶y̶s̶t̶e̶m̶s̶ ̶p̶r̶o̶g̶r̶a̶m̶i̶n̶g̶.̶
- rowanG077 6y agoThis is a wapper around an existing js runtime. How is this systems programming?
- pjmlp 6y agoAh, I should have looked better then, as I thought it was a proper runtime. You are right.
- 1f60c 6y agoSlightly OT: how'd you type the strikethrough text? I wasn't aware HN supported that.
- pjmlp 6y agoIt doesn't, but does support unicode text, so use just another site and then copy-paste the result here. :)
- searchableguy 6y agoPlease don't do that for accessibility reasons.
- pjmlp 6y agoPlease explain.
- gostsamo 6y agoNot all unicodes are equal for a screen reader. The text in case is read for me as every letter is separated from the others by a unpronouncible symbol and the whole line becomes a mess. Something like the chicken language, if you are acquainted with the concept.
- pjmlp 6y agoI see, thanks for explaining. Anyway to do it in a more screen reader friendlier way?
- deleted 6y ago[deleted]
- gostsamo 6y agoBesides leaving effects to the fond, I'm not quite sure. The screen readers must be told to treat one symbol as another and this is not something easy in plain text format. In HTML that you own, you can try to do it with images and alt text attribute, or some shenanigans with aria-hidden and aria-text. Front end is not my specialty, unfortunately.
- searchableguy 6y agoHey, I am curious which screen reader do you use? I have noticed that many cloud based TTS actually work fine with unicode which was surprising. I know google one does and it sounds way better than whatever comes in as default on Ubuntu (Orca).
- gostsamo 6y agoNVDA on Windows. Orca does not have high-quality voice for my language as far as I know and that renders it unusable for day-to-day usage. Keep in mind that screen reader and voices for it are different components that could be mixed. Both could be instructed to treat unicodes in whatever manner necessary, but it is labor intensive and euristics usually has some dubious results.
- faitswulff 6y agoThere are some benchmarks against Deno here (as JSON files): https://github.com/elsaland/elsa/tree/master/benchmarks https://github.com/elsaland/elsa/tree/master/benchmarks
- artagnon 6y agoOfcourse; Deno is V8-based, which is a lot more full-featured than quickjs. Perhaps this is a more informative benchmark: https://bellard.org/quickjs/bench.html https://bellard.org/quickjs/bench.html
- tomp 6y agoWow,, this is seriously bad. Calling this fast is very misleading. QuickJS is about 0.5x as fast as V8 without JIT (and like 20x slower than V8+JIT).
- tyingq 6y agoTrue for these benchmarks, but other than regex, most aren't what one would typically be doing with it. It would be nice if one of the benchmarks was more reflective of typical use.
- filleduchaos 6y agoThat a rocket is two orders of magnitude faster than a jetliner doesn't make a jetliner not fast.
- seg_lol 6y agoTrue statement, but what does that metaphor-analogy have to do with server side JavaScript runtimes? They are also not the same thing, Dragonflys are fast, but they won't run my JS either. Our systems have absolute speeds that the client requests don't care about. They don't care if they are fast for an _x_ when that _x_ has nothing to do with the client. Minimal is a nice quality, but I don't think Elsa is fast in absolute terms or as secure as Deno. I did an analysis in a different comment, it looks like Elsa comes in at 3500 lines of code, of which Go is less than a thousand. What this does is supply an outlet for Go programmers to contribute to a JS runtime like Deno which is mostly developed in Rust and TS. From a sociological perspective, it will be interesting to see how Elsa evolves and whether Go or TS dominate future development. What I think is neat is that QuickJS comes in as more computationally efficient (benchmark score / executable_bytes_size). But that also makes sense, jits have to work pretty hard to extract that extra performance. One would have to do some sort of coverage analysis to compare quickjs to v8 --jitless, interpreter to interpreter. It would be interesting to track the commits in a codebase over time wrt speed for interpreters and jits across a set of languages. # from https://bellard.org/quickjs/bench.html # total score w/o regex In [2]: 41576 / 28000 Out[2]: 1.4848571428571429 In [3]: 1138 / 620 Out[3]: 1.835483870967742 Given Fabrice Bellards other projects, I wouldn't be surprised if a JIT landed in QuickJS.
- artagnon 6y agoIt's a simple command-line application that dispatches to the quickjs runtime. The headline is somewhat misleading.
- Complexicate 6y agoLet it go. Let it go. Misleading titles never bothered HN anyway.
- sigzero 6y agoI wish I could upvote you more than once!
- cheph 6y agoI am quite happy that the topmost comment on a misleading post clarifies it. Clarity is good. So I guess I for one am happy someone did not let it go.
- hn_throwaway_99 6y agoIt was a joke based on a song from Frozen.
- gwbas1c 6y agoI've listened to that song so many times and I still didn't get the joke!
- codetrotter 6y agoSpeaking of which: https://youtu.be/LJvEIjRBSDA https://youtu.be/LJvEIjRBSDA Also, it’s weird how time flies. It’s been almost 6 years already since they made the version of the song in the video here linked, but it feels like just yesterday that I saw it.
- cheph 6y agoWow, what an amazingly effective way to make me never hear another word of golang ever again.
- mavhc 6y agolet it Go
- Aissen 6y ago@qu4k It's a shame that QuickJS isn't mentionned in the README since it does the heavy lifting. Also, why is it secure ? Is there some kind of sandboxing of the runtime that I have missed ?
- qu4k 6y agoREADME still needs some work and surely we will credit the awesome libraries that allowed us to build elsa We plan on taking the deno route and requiring flags when running a js file to allow specific ops to be called. You can see a demo of this in our filesystem ops
- deleted 6y ago[deleted]
- zokier 6y agoSo Elsas own comparison[1] says that the binary size difference is 20MB Elsa (QJS) vs 44MB Deno (V8). Looking at QuickJS benchmark[2] V8 is 28M vs 1M QJS, so Elsa adds 19M on top of the engine vs 16M for Deno. Doesn't feel that lightweight anymore [1] https://github.com/elsaland/elsa/blob/master/COMPARISON.md https://github.com/elsaland/elsa/blob/master/COMPARISON.md [2] https://bellard.org/quickjs/bench.html https://bellard.org/quickjs/bench.html
- seg_lol 6y agoIt is amusing how each of us define our own _lightweight_, for me it is the size and readability of the code. Others it is the magnitude of the executable bytes. To someone else it might mean the startup time, the number of dependencies or the build/test/debug iteration time.
- pwdisswordfish4 6y agoThe only reasonable application of "minimal" is for it to be a cross-cutting description. To describe something as "minimal" without qualification while focusing only on any single quality is not a good use of the term.
- adsjhdashkj 6y agoOoo, and one more: Depth of features. Software that achieves my goal in a focused manner is something i typically enjoy. I don't want it to do everything under the sun, i want it to do one or two things well. These days, to me, a "lightweight" alternative to Dropbox would be one that focuses on filesharing with none of that other junk.
- seg_lol 6y agoThere are foundational aspects on knowing a component is done, that it will be the same everywhere. What do you think of Nix [1]? The other quality of flexible composable systems is that they can be extended with something akin to an AoP system. Non-essential qualities can be woven and applied during composition so that each component doesn't have to implement various features. A counter example is the find command, it has to implement a predicate language into the tool itself. If it omitted typed objects, a filter engine could select the subset. If find implemented polymorphic values, the predicate would dictate what facets were populated in the structures themselves but our shells don't work that way. A metashell that could define its environment and the streams of structures flowing between components could get us closer to a pervasively composable mode of system construction. Unix pipelines [2] are awesome, but they aren't the pinnacle. I feel like all of us fall short in creating systems that compose. Most (scalable) systems should be fractal, while most composition is limited to a narrow first-order mode of operation. [1] https://nixos.org/ https://nixos.org/ [2] https://en.wikipedia.org/wiki/Douglas_McIlroy https://en.wikipedia.org/wiki/Douglas_McIlroy
- einpoklum 6y agoThe snowflake logo reminds one of Disney's Frozen, but - may also be confused with, well, Snowflake (the distributed database).
- varbhat 6y agoMention QuickJS Engine in the readme . I came to know that this project uses quickjs (i believe it is written by Bellard) after reading about it in "comparison with deno and node"
- qu4k 6y agoDone, thanks for pointing this out ;)
- bryanrasmussen 6y agothis made me wonder about a QuickJs wrapper for Rust https://github.com/theduke/quickjs-rs https://github.com/theduke/quickjs-rs
- jitl 6y agoIf you’re interested in using QuickJS yourself on the web or in node to implement untrusted JavaScript evaluation in your own (JavaScript) software, check out my library: https://github.com/justjake/quickjs-emscripten https://github.com/justjake/quickjs-emscripten
- sradman 6y agoHN thread Fast Vue SSR with Rust and QuickJS (2 months old) makes it clear that QuickJS is an alternative to V8. QuickJS is small and easy to embed but it lacks V8's JIT for fast JavaScript execution. It seems that the comparative advantage of QuickJS based solutions is short-lived invocations that benefit from fast startup times. CLI apps/tools and Cloud Functions (e.g. AWS Lambda) seem to fit the bill. Elsa adds Deno-like HTTP imports and TypeScript support which makes it a strong alternative to Deno for CLI apps/tools. Deno (V8 on Rust) or the rusty_v8 bindings seems like the better choice for long-lived servers where server-side JavaScript performance is important. [1] https://news.ycombinator.com/item?id=23887336 https://news.ycombinator.com/item?id=23887336
- oknoorap 6y agoInteresting alternative for Deno. I'll be waiting Olaf and Anna engine to come out.