3 ms·
How do you ensure cross platform compatibility under the hood?
by helsontaveras18 3y ago
How do you ensure cross platform compatibility under the hood?
- Jarred 3y agoWe implement a handful of the most common commands like cd, rm, ls, which, pwd, mv. Instead of using the system-provided ones, it uses ours. Unlike zx/execa, we have our own shell instead of relying on a system-installed one.
- reactordev 3y agoIs this done in zig in the core bun runtime or is it implemented as part of the standard bun lib? How much perf is there? Small commands like cd or ls I'm less interested in. You say you provide your own shell... bsh, zigsh, what?
- Jarred 3y agoIt’s nearly all in Zig. The parser, lexer, interpreter, process execution and builtin commands are all implemented in Zig. There’s a JS wrapper that extends Promise but JS doesn’t do much else. The performance of the interpreter probably isn’t as good as bash, but the builtin commands should be competitive with GNU coreutils. We have spent a lot of time optimizing our node:fs implementation and this code is implemented similarly. We expect most scripts to be simple one-liners since you can use JS for anything more complicated.
- reactordev 3y agoGood to hear you guys made the right decisions. Bun is awesome and the more performance you guys can squeeze with zig, the better. Keep it up! Bang up job already.
- natrys 3y agoThink this should be highlighted in the article, because that's actually pretty cool but the article gave me impression that it's a simple sugar over child_process only.
- airstrike 3y agoI had the exact opposite impression, FWIW. I understood implicitly (assumed?) that it was implementing its own commands