Here's we use sum of square matemathical operation to compare the perfomance between nodejs vs node+rust using neon binding.
- Reuse old code: Call code written in other languages without rewriting it.
- Choose the best language: Use different languages for different tasks.
- Improve performance: Use languages that are good at math and computation to speed up your code.
- Fix memory problems: Use languages that are good at handling memory to reduce crashes.
- Develop faster: Let developers work in the language they're most comfortable with.
- Test and prototype quickly: Test new ideas without spending a lot of time.
- Use native libraries: Integrate your code with existing native libraries.
- Build scalable applications: Make your application handle more users or data.
Installing requires a supported version of Node and Rust.
You can install the project with npm. In the project directory, run:
$ npm install
This fully installs the project, including installing any dependencies and running the build.
If you have already installed the project and only want to run the build, run:
$ npm run build
This command uses the cargo-cp-artifact utility to run the Rust build and copy the built library into ./index.node
.
npm build-release
Same as npm build
but, builds the module with the release
profile. Release builds will compile slower, but run faster.
npm test
Runs the unit tests by calling cargo test
. You can learn more about adding tests to your Rust code from the Rust book.
node index.js
node rust.js
To learn more about Neon, see the Neon documentation.
To learn more about Rust, see the Rust documentation.
To learn more about Node, see the Node documentation.