Deno vs. Bun performance is rigged
unetworkingab.medium.com
unetworkingab.medium.com
In either case, I hope they announce a correction and move on to more important matters. If youre trying to shave another tiny bit of rps out of your boxes then thats an incredible success problem; not the kind 99.999 of companies will need.
Performance is a very important thing in js world for a peace of mind of devs.
And I'm not even sure if the above is 100% accurate.
I benchmarked a hello world in .net and node/express, and the .net version was multiple orders of magnitude faster than the node/express version. That's a starting point, and as you add more logic, that gap only grows in my experience. Javascript may be fast _enough_ for many cases, and in a tight JIT loop it may be faster again, but by any measure, js is not quick.
One example is the techempower benchmarks Fortune section[0]. It's a fairly basic app, but it tests a full stack web app in multiple languages, and it's pretty clear that js is fimrly in the middle of the pack, far behind the compiled options. If you have any sources to the contrary, I'd love to see them.
[0] https://www.techempower.com/benchmarks/#section=data-r21&tes...
But a decent js implemention of 3D graphics-something would use one of the available tools for such applications. Making the difference considerably smaller.
Or is you experience different?
The three major blockers I remember were:
1. Render contexts are created on the main thread and the user of the library gets no control over this. This means all driver overhead and library function calls block the main thread, which matters a lot when trying to hit 8ms/frame.
2. Loading textures asynchronously (in another thread, not Javascript async/await) was straight up impossible due to poor architecture. This means app startup was 500ms instead of 5ms. Maybe not a big deal to you, but our use case necessitated quick (a few frames at worst) startup.
3. The renderer used a scene graph, which was hilariously slow to traverse for large numbers of objects. Impossible to optimize by anyone as far as I can tell. Scene graphs just don't work well in JS.
[0] https://www.techempower.com/benchmarks/#section=data-r21
4 ranks before .Net.
[0] https://github.com/TechEmpower/FrameworkBenchmarks/issues/72...
https://www.techempower.com/benchmarks/#section=test&runid=e...
the postgres driver was rewritten in JS because i spent so long benchmarking using the pg C driver and couldn't get the performance i needed from it. if you actually read the github thread you can see i even did a lot of work to verify the various frameworks were compliant with the requirements.
in round 21, postgres pipelining was disallowed for all frameworks and just-js/JavaScript is in first place. \o/
https://www.techempower.com/benchmarks/#section=data-r21&hw=...
https://github.com/TechEmpower/FrameworkBenchmarks/tree/mast...
More details in this thread: https://github.com/just-js/just/issues/5
Not that it is representative of actual use cases. Can't use just-js in production as it's hyper optimized for this benchmark rather than a work horse. But it does provide a better view of what is possible if the work is put in.
Just-js had spent a lot of resources optimizing the input and output gateways to the V8 engine and it obviously pays off nicely. It does serve requests with the JS.
Is the boundary in the same place? Not familiar enough with the others to say exactly. But does it really matter?
in techempower, the vast vast majority of code running in the just-js entry is JavaScript. all the core libraries for networking and interacting with the OS are js wrappers around C++/v8. the http server, though incomplete and not production rady, is written in javascript, with http parsing handed off to picohttpparser. the postgres wire protocol is completely written in javascript. in fact, one of the advantages JS and other JIT languages have is you can optimize away a lot of unnecessary logic at run time when you need to. e.g. https://github.com/just-js/libs/blob/main/pg/pg.js#L241
the whole point of doing this was to prove that JS can be as fast as any other language for most real world web serving scenarios.
if i had more time to work on it, i am sure i could improve the fortunes score where it would be at or very close to the top of that ranking too.
Where I think there’s more of a problem is cultural: similarly to Java, there’s a subset of programmers seemingly dedicated to layering abstractions faster than the JIT developers can optimize them.
Unfortunately, I don't have readily available data to back up my claim neither.
Again, not saying it never happens but I’ve rarely seen the kind of microbenchmark this story is about end up correlating with real application performance. I have seen developers get all fired up in some religious war and endanger their entire project trying to see benefits which never materialized, though, a common feature there was this focus on toy benchmarks rather than measuring the whole system or what they could do at the app level if they weren’t supporting some niche framework.
This sounds extremely accurate to me
For example, go can handle about the same amounts (be advised that this tests are for 4 cores, so results have to be divided): https://github.com/smallnest/go-web-framework-benchmark
StackOverflow peaks at about 6000 reqs/s and it's an extremely popular website.
also wondering what peak RPS is for HN. i feel like most (non consumer) startups would be like "ok if its good enough for HN its good enough for me"
It is [1] ( and should be ) pretty well known. 1.3 BILLION page view per month, 6K RPS with 9 ( Fairly Weak ) Servers, Sub 20ms response time with zero caching.
>also wondering what peak RPS is for HN.
Less than 100 RPS for logged in users. The number were pre 2020 but I doubt the current number is significantly higher.
I mean... to be clear, they do tons of caching[0], which is certainly critical for their ability to have a non-cached response time of 20ms. Most of their responses should be coming from a cache, given the type of site they run, otherwise they would need a lot more servers.
[0]: https://nickcraver.com/blog/2019/08/06/stack-overflow-how-we...
https://hanselminutes.com/847/engineering-stack-overflow-wit...
Dino makers are well aware of this. An otherwise great Python framework (based on Starlette) is even named "FastAPI" in an attempt to use this to their advantage (it is great for other reasons, not because of its speed).
Unfortunately lots of devs are looking for silver bullets when it comes to speed, instead of detecting, determining, investigating and removing the bottlenecks.
/S
Take this example from their docs:
@app.get("/items/{item_id}")
async def read_item(item_id: int, q: Union[str, None] = None):
return {"item_id": item_id, "q": q}
You are declaring the types of the parameters, and FastAPI parses and enforces them for you. This saves quite a bit of code, and lets you focus on your business logic. Writing the code this way also allows FastAPI to generate a meaningful description of your API, which can be schema (such as Swagger) that tools can use to generate clients, or it can be documentation pages for humans to read. Any good documentation will still require you to write things, but this gets you further, faster than using something like Flask.This example[0] takes these concepts even further.
Or just glance at the summary and see that it has nothing to do with @app.post.[1]
FastAPI has also properly supported async routes for longer than Flask, from what I understand.
(I've never personally used FastAPI for anything serious, since I have rarely used Python for anything other than machine learning for the past 5+ years, preferring to use Go, Rust, or TypeScript for most things, but I am aware of it, and seeing its claims misrepresented like that is mildly annoying. FastAPI is far more appealing to me than any other Python web framework I've ever seen, and I've only heard good things about it. Based on my experiences in other languages, their approach to writing APIs is absolutely a good one.)
Proper async support is decently important to me in any language or framework, but in the real world, I haven't often run into other developers who care much about that.
Typing is the base for many reasons I love FastAPI, so yes it is useful. And I speak as someone who has used it in production on multiple projects, and even converted some from Flask (but not because of speed).
Far from "fast to get going", starting with FastAPI is slower actually, but it takes you further (as you pointed out). The train of thought that "typing" leads to "fast to get going" which leads to "fast" in the name... Let's say I don't buy it.
The link to "performance" is difficult to miss, I don't think that is a coincidence. And it's OK. If this is what matters to devs that much, they would be stupid not to highlight it. I'm actually happy people are using it, even if for the "wrong" reasons.
- URL params, forms and query string parsing and validation
- (de)serialization format choice
- dependency injection for complex data retrieval (this one is very underrated and yet is amazing for identification, authentication, session and so on)
- output consistency guarantees
- API doc generation
Note that I don't hold this against them. They simply understand what makes the devs pick them and adjusted their market strategy accordingly. It would be nice if they didn't have to though.
And if your framework is faster, then of course you're going to mention it. Do you really think Flask or Django wouldn't point out that they were fast, if they were? I'm quite sure they would, since it's not shameful to educate the reader on what your framework offers compared to the competition, but they can't, because they're not.
Your link goes to the very bottom of that page, so is it really prominently featured compared to everything else they're trying to sell you on? It really doesn't seem like it. More convincing would be pointing to their list of "key features" at the top, which does mention performance first, but then quickly focuses back on "Fast to code" and "Fewer bugs".
I find the reason for using a tool often isn’t what they list first in their technical documentation.
I can understand why someone might think those really are the reasons to use that tool.
I agree that it’s harmful to distract from what actually matters: the core goal and competencies of the team.
But therefore we should hope devs look for silver bullets to address performance without having to be distracted by it. “It’s out of the box pretty good so I don’t have to think about caching or CDNs or load balancing until later” is deeply valuable.
I think that we as an industry don't have the best hindsight.
I'll use enterprise Java as an example of a few common situations:
- sometimes we go for Spring (or Spring Boot) as a framework, because that's what we know, but buy into a lot of complexity that actually slows us down
- other times we might look in the direction of something like Quarkus or Vert.X in the name of performance, but have to deal with a lack of maturity
- there's also something like Dropwizard which stitches together various idiomatic packages, yet doesn't have the popularity and tutorials we'd like
- people still end up being limited by ORMs, which can speed up development and make it convenient, but have hard to debug issues like over-eager fetching
- regardless of how fancy and "enterprise" your framework is, people still make data structure mistakes (e.g. iterating over a list instead of using a map)
- if you've written a singleton app (runs just on a single instance) that's monolithic, your background processes will still slow everything down
And then, people wonder why it's hard to change their enterprise codebase and wave around their hands helplessly when their app needs at least 2 GB of RAM to even run locally and answering some simple REST requests needs close to 20 seconds and the app does about 2000 database queries to return a relatively simple list with some data.When people should think about performance, they're instead busy "getting things done", when people should think about "getting things done" they're busy bikeshedding about which new framework would look best on their CV. And we even pick the wrong problems to solve, given that many (but not all) of the systems out there won't really have that stringent load requirements and just writing decent code should be our priority, regardless of the framework/technology/language.
I remember load testing a Ruby API that I wrote: on a small VPS (1 CPU core, 4 GB of RAM), it could consistently (over 30 minutes) serve around 200 requests/second with database interaction for each, which is probably enough for almost any smaller project out there. Doubling those resources by scaling horizontally almost doubled that number, with the database eventually being the limiting factor (which could have been scaled vertically as well). And that is even considering that Ruby is slow, when compared to other options. But even "slow" can be enough, when your code is decently written (and the scale at which you operate doesn't force your hand).
The idea was to see how performance intensive COVID contact tracking would be, if GPS positions were to be sent by all of the devices using an app, which would later allow generating heat maps from this data, instead of just contact tracing. Of course, I talked about the privacy implications of this as well (the repository was called "COVID 1984"), but it was a nice exercise to demonstrate horizontal scaling, the benefits of containerization and to compare the overhead of Docker Swarm with lightweight Kubernetes (K3s).
So yes, write heavy workloads are viable with Ruby on limited hardware, read heavy workloads can be even more easy (depending on who can access what data).
for projects of any significant size, that answer is a resounding "yes".
for anything that can plausibly grow in scope and team size (which, let's be honest here, is most complex projects), it almost never makes sense to go without an existing ecosystem. it becomes difficult to hire, difficult to train, difficult to pass off maintenance, slows down velocity of shipping, makes your team gradually re-invent a worse version of the framework/tooling you initially tried to avoid, etc.
i've been on both kinds of projects. when i build something solo it's a work of art in code size, API consistency, and performance...and that feels truly amazing. but unfortunately it's not something that is feasible with bigger and more diverse-skillset teams. ever-growing scope and shipping features quickly usually means giving up performance and well thought out design.
The challenge I have with these positions is that unless you have very specific latency requirements, most of the time youre better off focusing on solving a business problem and then measuring what is slow. Starting off with “well it has to be fast so lets use this brand new thing” is the swan song of the eventually remorseful.
This is the point GP is making - they (the "junior-wannabe-senior") aren't even thinking of all else, and by focussing purely on the speed of operations are probably using the lesser optimal solution. Facetious example: A is faster than B, shaving a few cycles here and there. But nobody knows how to use A, it's support is lacklustre, and there are many known vulnerabilities that haven't been fixed. B is the most widely used in the industry, support and security is good. Junior-wannabe-senior is picking A because it's faster.
All else is never equal. The level of adoption and support is what drives decisions in the end. That's why everyone still uses Node when Bun is probably better in every way.
>segfault at runtime
Bun is far from better in every way
But if it's that JS execution is outright faster, it's a big deal.
People here handwave "oh, your business doesn't require more than 10rps". Sure. But rps is just half the story, latency is the other. I'll give you two examples
1) SSR with something like Material UI is slow, especially because of the CSS-in-JS. The server rendering the page can easily take 200ms or more.
2) Modern backend stacks. On an API I have I use Prisma + Apollo GraphQL. Some queries take 500ms. These same queries but using REST and knex are <10ms. There is no slow SQL queries here or N+1 issues, it's just prisma and graphql executing a lot of JS.
In either case, the user experience is impacted because the website becomes slower. And a faster runtime would make these JS run faster, thus the web/api load faster.
There is also overhead in passing structures and other communication required so that layer can change the number as well.
If you're relying on innovation to make your existing tech stack not behave like dogshit when proven and trivial solutions exist, you're valuing the wrong things when choosing your stack.
I think the benefit of deno or bun aren't as obvious when compared in the context of node on DX matter too.
Most of the tooling and standard library can be used without using the cli and switching runtime.
Tools like tsx simplifies running typescript code directly. It does pretty much what deno does internally using esbuild.
The modularity of runtime doesn't matter to consumers even if it's pretty cool.
FFI and security features are nice but I think the future is running sensitive code as a wasm module directly in separate isolated context.
The browser compatibility is an awesome boost but most bundler will polyfill that for you out of the box and you will use a bundler with either deno or node most of the time. I know polyfilling is not perfect but it's good enough for most.
I want to hear what strong reason people have for choosing to use either bun or deno in production.
I use deno for writing scripts because it's so easy to run them especially if they have any dependencies but outside of that, I haven't reached out for it.
Developers should focus more about time spent getting an application up and running (and to market) rather than how much time is spent serving an http request.
If you're an auto manufacturer and you discover something like fuel injection that will dramatically improve efficiency for your customers (the people paying that bill), not doing so makes you a terrible engineer. The 'developer velocity' argument is pure BS... there's absolutely no direct (or even really indirect) correlation there. If the ones you have need someone else to write 9 libraries so that they can build a REST API, you need better engineers.
For work of speculative value (most startups...), optimising for dev efficiency is IMHO the right thing to do.
As for the error, I suspect it was an innocent mistake. I see no reason Deno would choose to mislead, when they’ve generally very publicly responded to performance deficits by acknowledging them and then actually improving real performance.
https://dev.to/builderio/a-first-look-at-bun-is-it-really-3x...
So we should intentionally handicap Deno? This is complete nonsense. If Bun wants to come out ahead of Deno, then they should also consider scaling with the number of CPU cores.
Single core CPUs are few and far between those days. Real-world performance is what matters.
There are definitely benefits of using multiple cores at once on a single app.
I would not be surprised if it's more common to run on a single CPU machine today than 10 years ago due to cloud VM instances.
My assumption is that this is a micro benchmark doing just an echo response, that is so far from what Bun/Deno/Node will ever be used for it’s just a farce.
The speed of your application frameworks http server will (almost) never be your bottleneck.
Developer experience, available libs, security model, packaging, deployment story, and to some extent resource usage (within reason) are far more important.
Searching Google for the exact text in the slide doesn't yield any results. So perhaps that was part of the post author's angst...that the numbers were presented in a venue where they wouldn't get much scrutiny?
Edit: I did find that the author has posted previously about Deno, and seems to not be a fan: https://unetworkingab.medium.com/deno-is-slow-and-why-associ...
> that the numbers were presented in a venue where they wouldn't get much scrutiny?
The OP has done the same though by not linking to or explaining the context. Or showing the code.
It seems like they are promoting their own library and doing a bit of their own deception by including a small library in their tests. Particularly a library that was designed entirely to perform well at that particular usecase (high throughout for small bits of data).
> Deno is a multi-threaded server that utilizes in this test almost 2x the CPU-time while Bun is running single-threaded utilizing only 1x the CPU-time.
How do we know this? Also, when the author says that Deno is getting "almost 2x the CPU-time", does that mean Deno was being run on a 2-core machine?
> If we run the same test on a MacBook Air M1, with latest Bun v. latest Deno, we get the following:
What "same test" was run? The M1 MacBook Air has an 8-core CPU. If the "same test" means the test that the Deno people ran in the presentation, shouldn't Deno still be beating Bun due to the multi-core advantage?
I'm very willing to believe everything in the article. But especially with the author requesting that we verify and think critically, it would be helpful to have more details.
Looking at the source code [0] for Deno HTTP server, they spawn at least one thread for the server to listen and handle requests, before they are sent through a MPSC channel to the thread running the Isolate.
[0]: https://github.com/denoland/deno/blob/07213dec94398aab687afd...
So the logical fallacy here is that since the Bun version is leaving more cores idle that we can run more copies to get even more throughput. Yes, but actually no. You’ll get more throughput, but not at the multiple you think. The real test of a system is when you redline it for all scenarios.
Unfortunately by the time the coding industry understand this , we'll already have a fifth JS runtime that will promise to solve all the performance issues that exist within the 4 others...
Node.JS / Electron are some of my most favorite tech , but if I need performance I'll go with Kotlin / Go / Rust , it's just simpler IMHO.
There are too many front-end JS frameworks and now it seems to be leaking to the backend as well in the form of runtimes. I'm just waiting for one of these groups to say "productivity is priority 1, followed by performance/security etc."
Because JS is sort of a nice sedan at its best - truly nice. But if you want a Ferrari, you're at the wrong dealership - that's a "you" problem.
Node.js is getting faster, for free, because things like Deno and Bun exist.
If you want DX you are better off with JVM, Rust or something similarly well designed. Hell, Go has better DX than JS/TS and that is a pretty low bar.
Real build systems, real module systems (instead of like 3 competing incompatible ones) actual compilers instead of transpilation BS. Actually good linters and static analysis. Actually good IDEs. The list of things all of these platforms do better than the whole JS/TS nightmare just goes on and on.
What you are getting when you buy JS is isomorphic code with browsers. That is all. DX? Forget it.
Deno is objectively a pretty nice package and does a better job than its JS predecessors of delivering on DX. But my fear is that JS is inherently fragmented and this will never be truly resolved. I personally wouldn't dissuade those from using it - you can still achieve great results. But it's not a poster child for how we should do things. That undertone bothers me a lot more than the runtimes themselves.
It's not the JS/TS language/syntax that is the problem per-se, but all the tooling that needs to exist around it for a decent DX.
NPM, Yarn, Babel, Webpack, TSC, ESLint, Prettier, even VSCode itself all contribute to an ecosystem that is a nightmare if you are trying to do anything outside of a handful of common scenarios
Tooling like Vite, Expo, CRA all try to reduce the headaches here, but at the end of the day just end up moving the headaches up an abstraction layer, and reduce the amount of supported scenarios.
That being said, there's not much support for using those languages outside of the ecosystem. Typescript is an incredible language, and if it was possible to transpile it to a language other than Javascript, that'd be ideal for me.
I'm trying to make it palatable with Bazel + rules_js/rules_ts and pnpm but even so still end up needing Babel and Webpack because browsers are a thing. This stack does make the build times somewhat more reasonable and actually manages to avoid too much wasted work locally/CI but boy does it take a lot of work to get done.
The time I'm investing in making a Typescript monorepo viable will pay off but only when compared to not implementing my changes and staying with TS, the comparison to simply not using the stack and using something better to solve our non-Typescript specific business problems would rather lopsided.
However I have different business goals where I can actually take some time to choose a non-TS stack...
... but unfortunately with those kind of goals/restrictions the choices aren't really there, afaik.
On the client-side, you have Flutter, which is cool enough (No JS, everything in a canvas), but I'm not Dart's biggest fan, and there's no Dart WASM target yet to be able to write in one language for both (and share types).
On the server-side, most cloud companies only support Javascript + Rust + WASM, and WASM just isn't mature enough yet where it's not a total pain to work with (I think it'll get there at some point though)
So I'm left pretty much where you are, my last and only hope is a Typescript monorepo.
I use C and C++ on a day to day basis, which has an extremely bad rap in the DX department. Even coming from languages that, by and large, have very poor DX, I find the JS and TS ecosystems to be intolerable. The tooling is extremely slow, buggy, and often produces straight-up incorrect results.
For me I would pick that again over the current state of Typescript/Javascript tooling. Atleast I felt like I had some semblance of sanity even when cobling together piles of CMake.
I have done front end development for hobby and professionally for over a decade. I can confirm that this guy does not understand the history, limitation and complexity of tooling around the ecosystem and is just here being uninformed and whining. Phrases like "real compiler" tell enough about people who mostly work in the back end that do not understand how the real world works for web.
Or let me ask this question: How would you change all this? Why would people find it better than the current status, and that proposal be universally adopted? And I am pretty sure you can't give a convincing answer. Because if it existed, people would have adopted it. Maybe you don't think this way, but there are a lot of smart people in this ecosystem and think about it a lot.
By the way, we have come a long way and are still much better than 2000s or early 2010s for many many reasons. I don't see any acknowledgement of that.
This however is a thread about using TS/JS on the backend as a web server and I think you will find all my arguments perfectly valid in that context.
Saying "Javascript tooling is better in 2022 than in 2000" is a useless statement even if true when saying "Javascript tooling is vastly inferior to JVM tooling" is also valid in 2022.
Just because it's better than it was doesn't make it good.
It sounds like he does, at least a little bit, because that's the problem he has with it?
>Phrases like "real compiler" tell enough about people who mostly work in the back end that do not understand how the real world works for web.
"How the real world works for the web" is the problem.
>How would you change all this?
WebAssembly/WASI is a pretty good start IMO: Having a compiled language with escape hatches to browser APIs is the ideal for me. Personally, the closest I've seen is Flutter's Skia/CanvasKit (which does use WASM, apparently). I'd certainly like to see applications of similar concepts in other languages/frameworks though.
Bun may be great someday, but right now it’s missing such basic functionality that any benchmark is a farce. Nobody cares that you can quickly ack a request a half million times a sec if you can’t do something as basic as spawn a child process.
These benchmarks don't make me think Bun is fast, they make me think Bun is cheating in something they don't need to cheat in yet.
Go heads down, finish adding features, run another benchmark when you're closer to parity and promote THAT heavily. Sure it won't be such a dramatic difference once you have to compare apples to apples but it'll be more honest.
I say this as someone who has gotten a lot of pushback in my career about performance work. Performance is a thing that needs to be priority. It doesn’t trump all else.
Make it work, make it right, make it fast. When people skip step 2 (and a godawful number of people do) they make enemies of themselves to their coworkers.
Also, just because Bun is single threaded doesn't mean they should get special exceptions in performance testing. If they don't like the numbers then give a comparable test with Bun using multithreading.
Maybe the chart should point that out, if that's the case. Or maybe the person running the benchmark should run more than one instance of Bun to make it an apples-to-apples comparison.
It's entertaining seeing these 2 camps throwing jelly at each other, it's healthy to a point and when it stops being healthy by that time most have moved on to the new shinny thing.
I suspect since both have taken investor money, that is a factor too.
And the bun-specific-fork-of-react vs deno + normal react, was suspect too.
When you import “react-dom/server” in browsers or Deno, it loads “react-dom/server.browser.js”
When you import “react-dom/server” in Bun, it will load “react-dom/server.bun.js”.
Its not so much of a useful thing to just focus so much on what you use to benchmark.
Reminds of:
https://www.theregister.com/2021/01/28/nvidia_tpc_benchmark/
https://www.zdnet.com/article/futuremark-reverses-nvidia-did...
Like, you wouldn't be impressed if it was react bun vs preact deno, right?
If you're going to excoriate someone for an improper benchmark, and then provide one of your own and advise your audience to "verify," then it might be wise to include instructions for how to reproduce your results.
I assume this has to do with how extremely experimental bun is at the moment anyway. So they are focusing on nailing the fundamentals before attempting anything that would make it „production ready“ such as multi core support.
As an aside, I’ve now seen a couple of HN submissions relating to Bun and there’s been a vibe that there’s conspiracy or foul play afoot in each. That’s a little … unusual. What does the developer seem like on Twitter, fairly normal or a bit eccentric?
That's inevitable when companies with big investments have to market a performance-oriented product to a public that doesn't fully understand the nuance of software performance running on modern hardware.
The average JS dev doesn't really know what's happening behind the scenes, so a precise message will not be nearly as effective as slapping together a long and a short bar in a barchart. And since this type of marketing is imprecise by nature, tweaking some details lets opposing parties corroborate conflicting claims.
I've been through this same phenomenon when working at Redis Labs. Everybody had the fastest cache and/or db. Both Redis Labs and each of its competitors. You just had to pick the right bar chart.
Bun will eventually implement Worker/worker_threads and that will have an integration with the HTTP server for load balancing
I thought bun was just a JS runtime, though I guess thinking about it maybe I don't even understand what a JS runtime is.
I always figured nodejs is v8 + an stdlib. I think bun is a custom zig-js engine + an extended stdlib (website claims "batteries included")?
Isn't the router generally "application/framework (i.e vue) specific"?
Does stuff like Express or Nextjs not actually ship a webserver and just use the underlying "runtime"'s `http.serve` function? Is it possible to make an analogous "webbrick to unicorn" server swap while still running nodejs or are you swapping runtimes to do that?
Any module system and dependency management is part of runtime (loading scripts, running them before executing code, etc).
Any other execution context such as workers or running wasm is also responsibility of runtime to implement and manage.
FFI or native extensions are also part of runtime. So one may use the built in networking APIs to build a server framework such as express or they may opt to bring their own networking layer through a native extension.
Frameworks such as express and next build on top of http node module.
Many of these APIs provided by runtime are also simply js scripts run in the global context before running your code.
Router is application specific, not part of any of the JS runtime but URL pattern can be used to build a router which is a standardized API implemented by both browsers and deno.
Runtime can choose to provide any API they want under their namespace so deno could provide a full blown router if they want to.
Does that clear it up?
https://github.com/just-js/just
Not that you should choose it over node or bun.sh or deno. I look forward to seeing where bun.sh ends up on the chart.
Currently (well, as of the last benchmark, in July) deno is 0.9%-1.6% of the speed of the fastest options, while faster node options are around 20-40%.
Would love to read what is going on here / what just is doing so much better than deno. I think deno is using a pure js server in that benchmark (vs it's newest/unstable ffi-based one) but, even still, 1% is awful.
E.g. a signficant number of frameworks on the techempower benchmark don't run with any timeouts in the various stages of a HTTP request lifecycle. That would mean if one would deploy those in the real world the server would sooner or later run out of memory or fd's due to broken client connections. Once you add timeouts, performance would already drop.
Then there is logging and metrics, which are absolutely required for any production setup, but never included in any of those proof of concept setups.
If the performance after those mandatory things is added drops 2 to 4x, the conclusions from the benchmarks can be very different.
However do the geniuses at Microsoft manage to make Windows run faster while only requiring faster hardware?
Says who? I searched for "windows 10 fastest" and the only relevant results were:
* claims about edge being faster, which is probably true given how much work they put into optimizing it for windows
* third party reviews saying that windows 10 S was faster (than home/pro), which is probably also true because it's so locked down that you can't run anything that slows it down
Also your search fu is weak. Try: "Windows new version" faster old version
Windows 11 faster than Windows 10:
https://www.tomshardware.com/news/microsoft-details-how-it-m...
Windows 10 faster than Windows 8:
https://edu.gcfglobal.org/en/windows10/windows-10-features/1...
Windows 7 faster than Windows Vista:
https://www.lifewire.com/ways-windows-7-beats-windows-vista-...
To be clear I don't doubt that the claims are technically true. Lies by omission are often technically true.