nodejs / help

:sparkles: Need help with Node.js? File an Issue here. :rocket:
1.45k stars 278 forks source link

How do I achieve the same performance as a multi-threaded language with nodejs, which is single threaded? #4246

Closed ItaloCobains closed 10 months ago

ItaloCobains commented 10 months ago

Details

I've already made some nodejs api's for some of my projects but I've been having some performance problems and I was recommended to use some multi thread frameworks like python's fastapi, I really like nodejs and I wanted to have the same performance for both rest apis and websocket etc. How can I achieve this? I'm no expert so I might be talking shit.

Node.js version

nodejs=20.6.1

Example code

No response

Operating system

Windows 11

Scope

Don't have code.

Module and version

Not applicable.

ljharb commented 10 months ago

to be clear, node isn't a language; JS is. node also supports wasm and native modules, so you can author in C++, Rust, etc, if the performance of JS isn't to your liking.

ItaloCobains commented 10 months ago

Sorry for calling node a language, do you have any article or document explaining how to create and use these modules?

thanks for the help.

ljharb commented 10 months ago

I don't have anything off the top of my head; https://blog.risingstack.com/writing-native-node-js-modules/ is something i just found on google.

ItaloCobains commented 10 months ago

thank you.