▲ | wink 4 days ago | |
> Node.js uses libuv, a C library that abstracts platform differences and manages async I/O through a thread pool. > Bun does it differently. Bun is written in Zig, a programming language that compiles to native code with direct system call access: Guess what, C/C++ also compiles to native code. I mean, I get what they're saying and it's good, and nodejs could have probably done that as well, but didn't. But don't phrase it like it's inherently not capable. No one forced npm to be using this abstraction, and npm probably should have been a nodejs addon in C/C++ in the first place. (If anything of this sounds like a defense of npm or node, it is not.) | ||
▲ | k__ 4 days ago | parent | next [-] | |
To me, the reasoning seems to be: Npm, pnpm, and yarn are written in JS, so they have to use Node.js facilities, which are based on libuv, which isn't optimal in this case. Bun is written in Zig, so it doesn't need libuv, and can so it's own thing. Obviously, someone could write a Node.js package manager in C/C++ as a native module to do the same, but that's not what npm, pnpm, and yarn did. | ||
▲ | lkbm 4 days ago | parent | prev [-] | |
Isn't the issue not that libuv is C, but that the thing calling it (Node.js) is Javascript, so you have to switch modes each time you have libuv make a system call? |