Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blog/on-javascript-performance-02/ #4

Open
utterances-bot opened this issue Feb 20, 2021 · 4 comments
Open

blog/on-javascript-performance-02/ #4

utterances-bot opened this issue Feb 20, 2021 · 4 comments

Comments

@utterances-bot
Copy link

Just(js): On Javascript Performance

A review of Javascript performance. Part 2 - Syscall Overhead in Javascript.

https://just.billywhizz.io/blog/on-javascript-performance-02/

Copy link

gohmc commented Mar 21, 2021

I think just.js can be a very strong data streaming & processing Javascript runtime engine; which current household name in that domain is kafka. With the ability to selectively build a static runtime, it may well be a practical JS engine on commercial embedded system (eg. instrument) as well.

@billywhizz
Copy link
Contributor

ho @gohmc. yes. i agree. 😀 if you are running on linux/x86_64 (with other architectures to come without huge amounts of work i think, arm64 as a priority for me) then this would be very good for low level streaming tools, with all the flexibility JS brings to the table.

tbh, i don't see the need for higher level streams api's when you limit yourself to linux. there are perfectly good and simple low level abstractions for these things built in (file descriptors, a small handful of simple syscalls you need to know about, epoll for async, some flags for different socket and file options). you could learn most of what you need to know about the core pieces in a few days reading the man pages and experimenting or reading a few chapters of APUE.

on top of that you get

  • a very small codebase to hunt through when you are debugging issues
  • mountains of documents and articles and books on the linux system interfaces.
  • experimenting/prototyping/refactoring is easier in js (for smaller programs at least) than it is in c/c++ or other statically typed languages.
  • as you say, the ability to statically compile your application and all it's dependencies into a single binary file

from the tests i have done there is a significant edge over node.js in not having to go through the layers of JS and C++ in node.js streams abstractions and libuv so if 20% increase in throughput is important to you as well as the above it could be a good option. you could argue counter to that that it may be just as well to write a c++ binding for node.js for whatever it is you are doing but i think there may be a not insignificant number of people who might prefer just-js for various reasons.

re. embedded i don't think it will be viable. for SBCs like raspberry pi and others on ARM it should be fine but for memory constrained devices and microcontrollers i don't think it would be possible to run v8. it might be possible to have a port or build option to build just-js using duktape or some other JS platform designed for memory constrained devices. this experiment from @indutny looks interesting and the perf is surprisingly good.

sorry. i've gone off on a few tangents. i got excited.

Copy link

@billywhizz Is just-js able to run anything that compiles to nodejs? For example, could I compile a TypeScript app in NestJS down to something that would run on just-js?

Copy link
Contributor

hi @SiavoshZarrasvand, no, there is no support for node.js api's currently and not really planning to support it. it would be possible wihtout a huge effort to create polyfills for some of the core node.js api's but it's not something i intend adding to core and would be something for others in the community to take on. happy to answer any questions aid the effort if there are people interested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants