Nodejs written in Rust?

509 views
Skip to first unread message

Johnin

unread,
Apr 3, 2015, 8:14:31 PM4/3/15
to nod...@googlegroups.com
If considering reimplement Nodejs with Rust will definitely see significant performance improvement and lower memory usage, our javascript will be improve much better.
http://benchmarksgame.alioth.debian.org/u32/compare.php?lang=rust&lang2=v8

What's your thought? Note: Rust 1.0 was released today.

Aria Stewart

unread,
Apr 3, 2015, 8:24:39 PM4/3/15
to nod...@googlegroups.com

That'd be more like noders than nodejs!

The thing to compare to there is C++, not V8, which about half of nodejs is written in. The other half is javascript, but that is in fact the point.

I am, however, looking forward to people's experiments writing node extensions in rust, however they figure out how to do that. (the ABI is a little nasty to access from non-C++ languages, but I bet someone comes up with a nice shim to link against)

Aria

Kevin Ingwersen (Ingwie Phoenix)

unread,
Apr 3, 2015, 10:23:05 PM4/3/15
to nod...@googlegroups.com
All that came to my mind was first a stupid hashtag: #interlanguagemodules.

But thinking about it, it could indeed be one interesting thing! :) Let’s look forward to this.

Stephen Belanger

unread,
Apr 3, 2015, 11:54:18 PM4/3/15
to nod...@googlegroups.com

Ben Noordhuis wrote some V8 bindings for Rust at one point, though I don't think they are up to date.

--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/20d77d84-83aa-4169-a5ca-eb470613faca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Benjamin Gudehus

unread,
Apr 4, 2015, 12:42:58 AM4/4/15
to nod...@googlegroups.com
I really like the idea and would see Ben's V8 bindings brought up-to-date.

It seems difficult to say, if a Rust implementation would be better
over all. Rust has its advantages with safer and easier programming in
comparison to C++, but is also lacking tooling and experts with 10+
years of expertise in the language.

I can't say much about the comparision behind the link, but it
compares Rust to V8, which implies we would have to implement the
whole JavaScript VM in Rust in order to gain this performance boost.
Well, this also seems apples compared with oranges; this benchmarks
JavaScript running on a VM implemented in C++.

Also note that Rust 1.0 wasn't released yet; it is expected due in six
weeks. However we only expect at maximum some minor breaking changes
until then.
>> <https://groups.google.com/d/msgid/nodejs/20d77d84-83aa-4169-a5ca-eb470613faca%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> Job board: http://jobs.nodejs.org/
> New group rules:
> https://gist.github.com/othiym23/9886289#file-moderation-policy-md
> Old group rules:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nodejs+un...@googlegroups.com.
> To post to this group, send email to nod...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nodejs/CABcFeBW_CceRBwNmuD6VybZir4jyU8TOO33qxTMbAib%2B58SBOg%40mail.gmail.com.

Alexey Petrushin

unread,
Apr 4, 2015, 1:57:25 PM4/4/15
to nod...@googlegroups.com
Not really, one of ideas behind Rust is easy concurrent programming, would be interesting to see something like Actors or Erlang like.

Aaron Gray

unread,
Apr 15, 2015, 11:46:48 AM4/15/15
to nod...@googlegroups.com
Reason, point of ?
> --
> Job board: http://jobs.nodejs.org/
> New group rules:
> https://gist.github.com/othiym23/9886289#file-moderation-policy-md
> Old group rules:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nodejs+un...@googlegroups.com.
> To post to this group, send email to nod...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nodejs/b464d09f-715b-41c2-91e8-fa6eb8ad663d%40googlegroups.com.

Alex

unread,
Apr 16, 2015, 9:14:50 AM4/16/15
to nod...@googlegroups.com
I suppose you could do inter language modules via Emscripten llvm backend. If it compiles to asm.js, the ownership semantics in Rust may or may not translate to lighter memory requirements in the VM; not sure. It would kind of be the worst of both worlds, I would think.

@AaronNGray

I dunno why this came up. Rust is a hot thing right now; people like to mix and match. Maybe you could leverage the huge number of NPM modules while reimplementing the hot parts of your code in Rust.

Rust is a very verbose language that precisely denotes who owns data. This means the system doesn't have to allocate extra data speculatively (memory savings), vulnerabilities and leaks are circumvented (error savings), and function calls are monomorphic (optimization boost). JS function calls frequently break monomorphism, which disrupt the poor JIT compiler's attempts to streamline things. See link: http://mrale.ph/blog/2015/01/11/whats-up-with-monomorphism.html

Rust is not exactly web server oriented, and the current APIs are mostly blocking. So I don't think putting rust into node makes a lot of sense. It might make a lot of sense for your node app to use add-ons written in Rust, though. E.g., a graphics processing addon could easily manage a thread pool safely and efficiently to handle jobs from node. It doesn't have to worry about blocking as much as your node app does. Rust is more for the endpoints, that do the actual computational heavy lifting. Node apps tend to be intermediate nodes. They stand between the web and something else: a database, filesystem, or number crunching endpoint (like a graphics library).

Hypothetically, you might build an API for a service similar to tinyPNG.com implemented as a node app. It might hand off jobs to a library similar to pngcrush that might be implemented in Rust.

I was at a talk with Steve Klabnik today and he said crates.io uses 25MB to run their package manager server. Of course, V8 has a large minimum memory footprint and GC memory usage can easily get out of control. Rust sounds like an efficient and robust systems programming language, but you have to think hard about a lot of details most smaller companies won't want to worry about when they're building a web API.

Just my take.

Aaron Gray

unread,
Apr 27, 2015, 11:03:56 AM4/27/15
to nod...@googlegroups.com
Whats going on with V8 modules with C++ name mangling and Rust ?
> --
> Job board: http://jobs.nodejs.org/
> New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
> Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> ---
> You received this message because you are subscribed to the Google Groups "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
> To post to this group, send email to nod...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/60452cfe-2cf8-41e4-8542-e536561412dd%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages