Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement]: Consider changing the runtime we use for JavaScript based servers (Bun?) #10

Open
1 task done
jonbarrow opened this issue Jan 24, 2025 · 0 comments
Open
1 task done
Labels
awaiting-approval Topic has not been approved or denied enhancement An update to an existing part of the codebase

Comments

@jonbarrow
Copy link
Member

jonbarrow commented Jan 24, 2025

Checked Existing

  • I have checked the repository for duplicate issues.

What enhancement would you like to see?

Mostly a place to discuss the idea, not necessarily a real proposal right now

Historically we have always only targeted the "essential default" of the server-side JavaScript ecosystem, that being NodeJS and npm. Even though there have been other runtimes/package managers in the past, our rationale for sticking with NodeJS and npm has been that other runtimes are not mature/lack features/are substantially different from Node, and npm is the default package manager that ships with Node. It's already likely that the developer has NodeJS installed and if so then they absolutely have npm already. Not targeting other runtimes/package managers removes a non-essential step for getting our servers running by not requiring the installation of additional non-essential tools

However as time has gone on, these reasons may not always remain valid. Specifically with the release of Bun 1.2, Bun looks like it's becoming a very viable alternative

I've been hesitant in the past to try and support Bun (even as an alternative, while keeping NodeJS compatibility) due to several controversial design decisions the Bun team has made. Such as:

Among others. However Bun does seem to be getting very promising, especially with the now built-in SQL and S3 support written in native code. Bun 1.2 also rewrote all of zlib in native code for a claimed 2x speed increase (Nintendo, and thus us, uses zlib a lot), and they claim a 3x speed increase for Express applications (which we use everywhere). Bun 1.2 also now targets the entire NodeJS test suite and has over 90% compatibility. Some of the non-100% cases are in areas we use, but it's unclear if they would affect us right now

Bun also comes with some additional benefits, such as top-level await and being able to run TypeScript applications without needing to transpile them first (which was a headache @binaryoverload had complained about very recently). It may be worth considering switching our target from NodeJS to Bun with this new release, though we would need to do extensive testing on ALL servers to ensure compatibility (Bun does not implement every NodeJS module, or every feature of every implemented module, which may cause issues not just for our code but also the code in dependencies which we don't control). Going all-in on Bun would mean losing NodeJS support, however. Which is something to keep in mind

One thing to keep in mind is that since Bun does not use V8 under the hood and does not fully support the node:v8 module, things like existing performance measuring tools/profilers likely will no longer function correctly. This may pose an issue, since we HAVE had issues with things like memory leaks in some of our servers which were only found through profiling

Any other details to share? (OPTIONAL)

No response

@jonbarrow jonbarrow added awaiting-approval Topic has not been approved or denied enhancement An update to an existing part of the codebase labels Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-approval Topic has not been approved or denied enhancement An update to an existing part of the codebase
Projects
None yet
Development

No branches or pull requests

1 participant