Hacker News new | comments | show | ask | jobs | submit login
[dupe] A safe Rust abstraction layer for native Node.js modules (github.com)
54 points by indatawetrust on July 21, 2016 | hide | past | web | favorite | 7 comments





When should I use this?

Like, which sub set of modules are better as a native version and which sub set of these are better written in Rust?


There are a few basic use cases I envision being the most common:

- When you have a portion of your Node app you really want to optimize (Rust's baseline computational performance is generally much faster than Node's and is easier to optimize predictably). - When you have a part of your algorithm that you want to parallelize. - When you want access to native libraries and need some glue code to expose it to JS.

One important caveat: there's a significant cost to calling back and forth between Node and Rust (I hope I can improve the cost over time but it'll never be free), so the use cases that fit the best will be ones where you're doing a lot of work in Rust so the amortized cost of crossing that boundary is small compared to the savings you get from Rust.


As dietrichepp said parallel programming would be a good fit for Rust. See if this works for you.

https://blog.rust-lang.org/2015/04/10/Fearless-Concurrency.h...

Edit: you could also do safer C/C++ interop with JS through Rust, if you want to use some legacy code.


FYI (or whoever can make the fix), the link titled "share stack frames" (to http://static.rust-lang.org/doc/master/std/thread/fn.scoped....) on that page is dead.


Parallel programming in JS is a total nightmare. It's a lot easier in Rust.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: