► What should I test next? ► AWS is expensive - Infra Support Fund: buymeacoffee.com/antonputra ► Benchmarks: th-cam.com/play/PLiMWaCMwGJXmcDLvMQeORJ-j_jayKaLVn.html&si=p-UOaVM_6_SFx52H
❤ Thank you so much Anton, you Champion You are doing a huge service to the industry here, and it’s much appreciated by a lot of people you have never met
Based on your previous tests i can say Go has been so consistent in terms of its performance and no one has ever raised suggestions to change your Go code to increase the performance. This shows how productive Go is
@@baxiry. "avoids" them... yeah, he's followed many suggestions. I don't think writing your own HTTP responder in gnet is as user-friendly as stdlib or Gin. There's a limit to what "optimizations" make sense for this style of benchmark.
For Java, the vertx-web framework is by far the most interesting and most likely to get realistic use in production due to its maturity (there is also Redkale, but it's in chinese). In fact they outperform Actix. Node doesn't hold a candle to any of these frameworks in terms of performance. See Techempower benchmark for info.
I think this really is much more a comparison of frameworks than one of languages. It would be very interesting to see the system calls performed during such a benchmark to see what is actually responsible for the different performance characteristics. I would expect there to be very little computational load other than shuffling data back and forth and because of that, I would expect Zig to perform better and also improve more over time because it offers a tad more control over what's actually being done. What I find really amazing is that we spend a vast amount of time shuffling data with very little real processing of that data. Sometimes I wonder why we do that so much and so enthusiastically.
No unexpected surprises here. Given the odds Go has done very well against the non-GCPLs. I just find it surprising that Google didn't make Go the one language to rule all its stacks (Android, Chrome, ChromeOS, Flutter, Angular etc) when it's so surprisingly performant.
rewriting flutter in go then ditching dart is good idea too ! 'flutter is future' after carbon lang was released after ten years then rewriting them all to carbon and so on
By Angular in Go you mean some kind of Go to js compiler right? because with wasm you will need to ship runtime to the client. Google did tried to 2nd repo of Angular with Dart but it never picked up steam + Google did it like an afterthought they never spent promoting it.
@@ristekostadinov2820 either a Go to JS compiler or a full batteries web framework in Go where you still write frontend code in TS. I prefer the second one because I already know TS, I feel web devs should not avoid JS even though they may not like it, also an extra layer of compilation adds overhead time and Go's amazing speed should not be affected like that. As for Flutter-Go I'd imagine it to be much like RN, no need to learn Swift/Kotlin/C/C++ in depth. Flutter was supposed to target desktops too, but Dart is just not performant enough to write cross platform software. Btw, it seems there are also Go libraries that can compile Wasm modules.
@@majesticonyx it has safety features but not as safe as rust. on the other hand it's less complex and verbose. so if you like the simplicity of go and the safety of rust, zig would be the middle ground.
Even if it weren't as fast as it is, I'd still enjoy writing in Zig. It's a fun language that does a really good job of not overcomplicating things. I tried to like Rust. I'll keep trying, too.
I'd love to see a summary (even just a community post) of what these tests cost you. Also, when making requests, do you use internal k8s namespacing, ec2 private IPs, or public/elastic IPs?
best case $10, $50 worst case, if you forget to tear down one night it's up to $200 😊 for tests like these i use service of type clusterip which underneath uses pod secondary ips native to aws vpc
@@AntonPutra do you mind creating a video to explain the infra side of this tests, I would like to learn more about how you make the load test, the tool you use for graphs and so on
One thing I think should be done is increasing the number of CPU's. GO routines would actually fair a bit better if given a bit more opportunity for concurrency. Plus, I personally would like to see how rust and zig perform with more CPU's as well, because depending on the multi-threaded implementation we could start to see bigger differences. Overall good video though!
@@pietraderdetective8953 Imagine getting triggered over safety without compromising performance. Zig has no benefits over C or C++. Who are you kidding? Stop being a hype journeyman.
@@KushLemon all the code is available to read, and compare to the rust code. You are free to point out any lines that are missing the safety that you think only rust has. There are only 65 lines of code there. Which one is missing the special rust-only magic safety ?
That's more or less how I expected zig probably keeps everything related to request in some nice arena, rust has some small overhead for memory managementy and go has gc
@@AntonPutra working on it .. we do have an excellent Postgres client now for zig that has several advantages over the go lib. All the guys working on these zig full stack libs are Go veterans. Just need to spend some time with those Postgres examples from go that you posted before From what I’ve seen with using zig Postgres in prod, having ported go apps to zig … I would expect to see some marginal gains over go at least. If the SQL test is processing a large number of rows - at least a few hundred rows in 1 request, with a tonne of embedded array fields, or JSONB, then zig slaughters the best Go code, due to Go needing to allocate + dupe each field in the resultset
I remember in previous benchmarks, when Rust people were overly vocal about how Rust crushed Zig, but now everyone seems very silent about the Rust dominance. I love Rust but Zig is faster, and in fact I think the most impressive metric here isn't the sheer speed and performance of Zig compared to Rust, as they are both very similar and Zig is just winning by a small margin, but the fact that this is still a pre 1.0 language, and that everything developed here, took very few people, very little time, whereas Rust has had years worth of programmers time in building those frameworks, and still falls behind in terms of speed.
Yeah 100% This bench is very much a tuning exercise (since both zig and rust are front ends to llvm) Zig allows us to “move fast and tune things right” :) The other impressive metric is looking at deps .. as IMHO, deps are the root of all maintenance evil The zig build has 1 only dependency The actix app has over a hundred
@@steveoc64 This is true, I never liked dependency in Rust, its "too easy" to invite dependency, which is understandable because It takes time to make things from scratch in Rust, but yeah one drawback is that one dependency, has another dependency, which has another dependency, and soon enough you have 100 deps, In Zig, the Std is the main dependency, you have most of what you could be looking for.
@@npcemprove6016 not every company can afford to just buy a new server. if you work in Formula One, you’d know you can’t just buy a new server willy-nilly due to the FIA regulations and that it’d make a lot more sense to write optimised software.
@@rohithkumarbandari it's no Julia yet, so long as it all boils down to llvm C will be king. It just takes one poorly implemented zig binding to a C lib to cause issues. One day we'll get modern under-the-hood improvements baked in. LLVM holds the crown for now in terms of usability
Thank you for the tremendous efforts you're putting into providing us with these tests. However, I have a small remark: you are mainly comparing frameworks and not programming languages, so the title is incorrect. It should rather specify: Rust (Actix) vs Zig (zzz) vs Go (StdLib), and for Go, it's not a framework. There needs to be some consistency in the tests, comparing similar things. Comparing Actix to ZZZ is like racing a truck against a motorcycle-of course, the motorcycle is lighter and will win. You need to take a minimalist library in Rust and compare it to ZZZ, and there are several available. Once again, thank you for your efforts.
Great content as usual, but I just want to point you out that the voice in almost all your videos is very low I have to max out the audio on phone/pc to be able to hear your clearly
That is... not what Mojo is. It is not yet even a superset of Python (except in so far as it currently embeds a Python interpreter if necessary, iirc, but that's hardly "optimized" or "compiled"), though it intends to be.
i really enjoy your videos, the quality is really nice. Can you do one with vlang (maybe vlang vs golang or zig/rust) ? because i've seen pico.v on top of benchmarks for a while and i wonder if it can be that fast in real case senarios. Anyway thanks
3:40 Im quite surprised at the drop outs in rust availability. Despite Go having almost 10x as much latency, it has not dropped at all. This doesn't seem normal because why would 1 out of 50k requests just randomly fail? Might warrant further investigation imo. *Edit: at 4:10 Rust drops 9 out of 90k requests, while Go still doesnt drop a single one. And at 4:30 Go drops its first request, while rust drops 21 out of 106k. Something hast to be wrong, otherwise 6:50 would not look this wierd.
@@AntonPutra okay thanks, we can wait until end of the month once NodeJS 22 becomes the official LTS. so that it becomes NodeJS 22 vs PHP 8.3. I'm also excited for the Deno 2 comparison :D
NodeJS and nginx+phpfpm have very different execution models, it wouldn't be a fair comparison. Comparing NodeJS with something like PHP Swoole would be a fairer comparison (both event-based asynchronous runtimes)
@@dansouza1623comparing to what most people use would be more fair. With php most people just deploy it using cpanel shared hosting, not a manual from scratch vps setup. But yeah comparing to php swoole would be interesting too.
if you look at it from the fair point even when golang is not doing any optimization hacks it's still keeping up a good rate. zzz uses io_uring under the hood so obviously it will be faster because there are less syscalls. I like to see how it compares with gnet in golang which also uses io_uring👍
I acknowledge that zzz could be faster than Rust from the start because it used io_uring as the runtime. I expect that changing the global allocator in Rust and switching to tokio-uring could lead to better performance.
This kind of test is not very important to most real systems. To a few unique systems it can be crucial. All the service does is return a string (not sure if it is static or not), which no real system does at high rate. I am pretty sure you can make a Rust version that would be as performant for this specific test (though I don't know Rust). It really matters what framework you use for such an a service. On the other hand, if you add async complexity, where the service needs to perform other requests, your test becomes meaningless. What you should really do instead is design a test where the service does some DB query. The results will be much different. Better, if you can simulate some variance with some DB requests being slow on purpose, then measure the capacity (QPS) of each solution.
Почему-то мне кажется что раст и зиг так и останутся просто игрушками. С точки зрения количества спецов на рынке и перфоманса го это идеальный вариант.
I think this is a bit unfair to golang tbh. ZZZ is using io_uring instead of epoll which will significantly improve performance. Actix doesn't look like it's using it so kudos to rust for keeping up with a nice performance even without it. One "flaw" of the ZZZ framework it seems is not to provide the handler with a `std.io.Writer`, which means it could potentially outperform rust even more if it avoids this two-step process (write to function-local memory, then pass it on to the HTTP buffer), but I guess it could be hard to do that with io_uring? idk, but feels like a potential improvement there. As for go, it seems to be stuck in the worst of all scenarios: Not using io_uring, allocating tons of memory *and* serializing json through reflection, but I guess that's the point of using the default library in go's case. I'd imagine a custom json encoder would easily skew the graphs for golang.. It really depends on how much one wants to refactor. If the goal is to deliver "regular joe's" kind of performance, maybe this is significant enough, though, again, it's a bit unfair that go doesn't do io_uring while zig does. However, if one wants to test highly optimized versions of each app then I assume going with the default golang library is not the best choice against a 45 star, 4 month old library crafted to be _the_ most performing zig HTTP server.
ReleaseFast You can see the PR where this code is submitted- it has bench figures for debug + safe + fast Zig debug is a bit slower, zig safe is about 2-5% slower than fast .. doesn’t make a huge difference Rust debug is significantly slower than zig debug mode Rust release and zig fast are more or less equivalent in terms of memory safety. There is no transfer of ownership happening in these handlers, so the extra safety of the borrow checker isn’t coming into play here. The zig build has better memory leak safety than rust here, due to using arenas over RAII style memory cleanups
not sure how to submit a pull request but something worth noting is if a function constructs a Device object the generated assembly has some lea instructions in it (according to godbolt with -O). conversely if u declare the device to be const, then only mov and movups instructions are used,, which could improve performance
Even though I love developing apps in Rust. I always see Zig will slightly be more performant than Rust since Zig is like the modern version of C. Great content! Thank you Beyonce!
C, Rust, and Zig are all systems programming languages without GC etc. Barring compiler optimizations, there is no reason why any of them should be faster than the other. If you browse the results of the benchmarksgame, you will find plenty of Rust submissions that are faster than C and vice-versa.
@@AntonPutra Thank you for responding, I saw it in source code, but couldn’t find source code for “clients”, could you share it too or maybe give me a hint where it could be?
What about the Elixir Phoenix tests? But in fact, it is much easier for him to work with persistent connections, like WebSocket, but it is still interesting to compare it with other high-level languages like Go or C# / Java. Ideally, when working on 2-4 threads
Why does the cpu profile have downward spikes for zig and go but not for rust? What’s the behaviour difference, is this a difference in how tokio is scheduling work? 6:21
wow zig 0.13 is close to rust in cpu usage from the beginning and more memory efficient for more requests what will it be after the V1 And i think they said zig is lower than c and closer to asm
► What should I test next?
► AWS is expensive - Infra Support Fund: buymeacoffee.com/antonputra
► Benchmarks: th-cam.com/play/PLiMWaCMwGJXmcDLvMQeORJ-j_jayKaLVn.html&si=p-UOaVM_6_SFx52H
C++ Zig Go. C++ using boost maybe.
Deno2 vs Go/Python.
Hey Prime reacted to your Bun vs Go video.
Could you make a video on how to perform such benchmarks? Please
Scala-ZIO-HTTP vs elixir-phoenix vs go
I am impressed by Zigs performance!
finally 😊
It's amazing how fast you upload this quality content
thanks!
❤ Thank you so much Anton, you Champion
You are doing a huge service to the industry here, and it’s much appreciated by a lot of people you have never met
thank you! ❤
so just support hime to buy coffee
Let's go with: rust vs c vs c++ vs zig
Will be sooooooo interesting to see
noted!
@@AntonPutraYes please this is an actual test
I think zig and c will be the same in term if performance
@@podakov it depends on the framework being used
addict to this channel, plase dont stop to make videos
🫡
Your contents are becoming very good each day. Good job Anton!
thanks!
Based on your previous tests i can say Go has been so consistent in terms of its performance and no one has ever raised suggestions to change your Go code to increase the performance. This shows how productive Go is
Performance-optimized Go frameworks and libraries are well known. They perform similarly to Rust, but the video author avoids them.
@@baxiry. Which ones have you suggested to use that were avoided?
@@baxiry. "avoids" them... yeah, he's followed many suggestions. I don't think writing your own HTTP responder in gnet is as user-friendly as stdlib or Gin. There's a limit to what "optimizations" make sense for this style of benchmark.
i'll do the best go frameworks vs the best rust frameworks soon, including fiber and ntex
@@baxiry. There is no way go would be as fast as rust
deno 2 is out, so if a deno vs bun would be interesting !
Deno claims to be better than bun in many benchmarks
coming in a week!
@@cesarmartinez2207 yes Deno rocks! `deno serve -parallel` is a game changer for simplicity and performance!
I am using deno to build a extension system as a runtime, works nice, feels safer with a sandbox
@@huakun extension system for a browser?
I’m interested to see C# vs Java or C# vs Node :)
Thanks for your job !
For Java, the vertx-web framework is by far the most interesting and most likely to get realistic use in production due to its maturity (there is also Redkale, but it's in chinese). In fact they outperform Actix.
Node doesn't hold a candle to any of these frameworks in terms of performance. See Techempower benchmark for info.
thanks! noted!
@@AntonPutra plz use more at least 2 CPU and use .NET 9 as it comes out in Nov 12th (officially)
Peak performance JVM (after warm up Amazon Corretto) vs Go! That would be awesome!
noted! i'll do java soon
@@AntonPutra maybe good to add c# with dotnet core as well to that same test as its the same target audience as java and similar all-purpose ?
@@random-i2s Indeed, good idea!
@@AntonPutra this
@@AntonPutra Java Spring vs Quarkus vs Micronaut would be awesome!
I think this really is much more a comparison of frameworks than one of languages. It would be very interesting to see the system calls performed during such a benchmark to see what is actually responsible for the different performance characteristics. I would expect there to be very little computational load other than shuffling data back and forth and because of that, I would expect Zig to perform better and also improve more over time because it offers a tad more control over what's actually being done.
What I find really amazing is that we spend a vast amount of time shuffling data with very little real processing of that data. Sometimes I wonder why we do that so much and so enthusiastically.
Zig is really impressive
No unexpected surprises here. Given the odds Go has done very well against the non-GCPLs. I just find it surprising that Google didn't make Go the one language to rule all its stacks (Android, Chrome, ChromeOS, Flutter, Angular etc) when it's so surprisingly performant.
Angualr in Go would be awesome.
well, i think there are already a lot of libraries written for each stack, and rewriting them in go would be time-consuming
rewriting flutter in go then ditching dart is good idea too ! 'flutter is future' after carbon lang was released after ten years then rewriting them all to carbon and so on
By Angular in Go you mean some kind of Go to js compiler right? because with wasm you will need to ship runtime to the client. Google did tried to 2nd repo of Angular with Dart but it never picked up steam + Google did it like an afterthought they never spent promoting it.
@@ristekostadinov2820 either a Go to JS compiler or a full batteries web framework in Go where you still write frontend code in TS. I prefer the second one because I already know TS, I feel web devs should not avoid JS even though they may not like it, also an extra layer of compilation adds overhead time and Go's amazing speed should not be affected like that.
As for Flutter-Go I'd imagine it to be much like RN, no need to learn Swift/Kotlin/C/C++ in depth. Flutter was supposed to target desktops too, but Dart is just not performant enough to write cross platform software.
Btw, it seems there are also Go libraries that can compile Wasm modules.
Zig is just great!
Zig really caught my attention.
it's fast
@@AntonPutra Is it as memory-safe as Rust?
@@majesticonyx it has safety features but not as safe as rust. on the other hand it's less complex and verbose. so if you like the simplicity of go and the safety of rust, zig would be the middle ground.
Even if it weren't as fast as it is, I'd still enjoy writing in Zig. It's a fun language that does a really good job of not overcomplicating things.
I tried to like Rust. I'll keep trying, too.
@@majesticonyx no. Just C with defer keyword.
zig is insane. Wow!!!😮
it is nice
I loved the video. Excellent work!
Watching you with your stuff reviews are like find out best hand tool that will not suffering your team and your own fingers.
😅
I'd love to see a summary (even just a community post) of what these tests cost you.
Also, when making requests, do you use internal k8s namespacing, ec2 private IPs, or public/elastic IPs?
best case $10, $50 worst case, if you forget to tear down one night it's up to $200 😊
for tests like these i use service of type clusterip which underneath uses pod secondary ips native to aws vpc
@@AntonPutra do you mind creating a video to explain the infra side of this tests, I would like to learn more about how you make the load test, the tool you use for graphs and so on
Wow, what a team 😳 Nice 👌 Love this videos 😅
thanks! :)
Great job anton as always😊
thanks ! :)
Thank you! This is awesome. Is it possible to do a database test like Test 2 with these languages?
yes i was promised Zig PR with database implementation, as soon as i get it will do
One thing I think should be done is increasing the number of CPU's. GO routines would actually fair a bit better if given a bit more opportunity for concurrency. Plus, I personally would like to see how rust and zig perform with more CPU's as well, because depending on the multi-threaded implementation we could start to see bigger differences. Overall good video though!
thanks for the feedback, i'll do a dedicated test 1 golang instance with 4 CPUs vs 4 golang instances with 1 CPU.
@@AntonPutra Thats a great idea! Can't wait to see it.
Test Spring Boot Webflux (Java) vs Go vs Node (JavaScript) next please!
noted, i'll do java soon
Ziggggggg…man I love zig.
😊
You must love segfaults. 😂😂😂
@@KushLemon how's that C++ training wheel? feels comfortable? i mean yeah safety safety safety! 😉😜
@@pietraderdetective8953 Imagine getting triggered over safety without compromising performance. Zig has no benefits over C or C++. Who are you kidding? Stop being a hype journeyman.
@@KushLemon all the code is available to read, and compare to the rust code. You are free to point out any lines that are missing the safety that you think only rust has.
There are only 65 lines of code there. Which one is missing the special rust-only magic safety ?
That's more or less how I expected zig probably keeps everything related to request in some nice arena, rust has some small overhead for memory managementy and go has gc
i wish someone could help with zig and postgres implementation
@@AntonPutra working on it .. we do have an excellent Postgres client now for zig that has several advantages over the go lib. All the guys working on these zig full stack libs are Go veterans.
Just need to spend some time with those Postgres examples from go that you posted before
From what I’ve seen with using zig Postgres in prod, having ported go apps to zig … I would expect to see some marginal gains over go at least.
If the SQL test is processing a large number of rows - at least a few hundred rows in 1 request, with a tonne of embedded array fields, or JSONB, then zig slaughters the best Go code, due to Go needing to allocate + dupe each field in the resultset
just came after watching prime reaction to bun vs go
😊
Anton, could you do another comparison between these three, but with a db call, like you did with Bun vs go ? Thank you.
Nim vs Zig next, please!
noted
I remember in previous benchmarks, when Rust people were overly vocal about how Rust crushed Zig, but now everyone seems very silent about the Rust dominance. I love Rust but Zig is faster, and in fact I think the most impressive metric here isn't the sheer speed and performance of Zig compared to Rust, as they are both very similar and Zig is just winning by a small margin, but the fact that this is still a pre 1.0 language, and that everything developed here, took very few people, very little time, whereas Rust has had years worth of programmers time in building those frameworks, and still falls behind in terms of speed.
Zzz is faster than actix
So, zig is faster than rust. Nice!
Yeah 100%
This bench is very much a tuning exercise (since both zig and rust are front ends to llvm)
Zig allows us to “move fast and tune things right” :)
The other impressive metric is looking at deps .. as IMHO, deps are the root of all maintenance evil
The zig build has 1 only dependency
The actix app has over a hundred
Cheating at a meaningless plaintext benchmark like gnet 🤣
@@steveoc64 This is true, I never liked dependency in Rust, its "too easy" to invite dependency, which is understandable because It takes time to make things from scratch in Rust, but yeah one drawback is that one dependency, has another dependency, which has another dependency, and soon enough you have 100 deps, In Zig, the Std is the main dependency, you have most of what you could be looking for.
@@RustIsWinning It's ok dude you don't have to be petty about it, a win is a win.
Every programming language is about community, docs, packages, productivity, love etc. Performance is a bonus.
well, as a devops engineer, i can tell you it's also about COST
@@AntonPutra 😂😂 right.
Agree. I have worked in companies where adding a new server is cheaper than optimizing software. Its sad true. So didnt notice cost aspect in time.
@@npcemprove6016 not every company can afford to just buy a new server. if you work in Formula One, you’d know you can’t just buy a new server willy-nilly due to the FIA regulations and that it’d make a lot more sense to write optimised software.
@@stxnwYou work at F1? 😮
Why go stdlib if fiber was top notch in your previous benchmark?
Most representative of typical use, the fact that it performs as well as it does with zero dependencies is a huge win imo
i'll do the best go frameworks vs the best rust frameworks, including fiber and ntex, soon
Очень интересно, хорошая работа!
spasibo!
zig
😊
@AntonPutra seeing Zig vs Rust(nTex) would be interesting
yes will do soon and gnet
Sanity test me with a pure C application in the mix please! Lets see how the OG competes :D
assembly
@@elvispalace same thing, C just makes it portable :)
can you please raise PR?
zig is going to be faster.
@@rohithkumarbandari it's no Julia yet, so long as it all boils down to llvm C will be king. It just takes one poorly implemented zig binding to a C lib to cause issues.
One day we'll get modern under-the-hood improvements baked in. LLVM holds the crown for now in terms of usability
MORE DATABASE TESTS!🚀
i'll do more
Thank you for the tremendous efforts you're putting into providing us with these tests. However, I have a small remark: you are mainly comparing frameworks and not programming languages, so the title is incorrect. It should rather specify: Rust (Actix) vs Zig (zzz) vs Go (StdLib), and for Go, it's not a framework.
There needs to be some consistency in the tests, comparing similar things. Comparing Actix to ZZZ is like racing a truck against a motorcycle-of course, the motorcycle is lighter and will win. You need to take a minimalist library in Rust and compare it to ZZZ, and there are several available.
Once again, thank you for your efforts.
Lovely series!
thanks! 😊
Would love to see framework comparisons of the same language.
yes, i'll compare the best frameworks for each language soon
Great content as usual, but I just want to point you out that the voice in almost all your videos is very low I have to max out the audio on phone/pc to be able to hear your clearly
Java Vertx vs Go StdLib?
ok noted! i'll do java soon
@@AntonPutra I am interested in the Vert.x too, if you can also add rust for comparison it would really be great 💪
Thank you. This feeds my confirmation bias.
Zig 💪
Maybe you can run the same tests for all languages and create a website where people can pick which languages and framework to compare, like stateofjs
ok i'll think about it
@@AntonPutra I could help if you need
I'd be curious to see some of these newer languages against the current version of Mojo (an optimized Python-language compiler).
That is... not what Mojo is. It is not yet even a superset of Python (except in so far as it currently embeds a Python interpreter if necessary, iirc, but that's hardly "optimized" or "compiled"), though it intends to be.
Haha not the closed source compiler again 😂
ok i'll try Mojo soon
i really enjoy your videos, the quality is really nice. Can you do one with vlang (maybe vlang vs golang or zig/rust) ? because i've seen pico.v on top of benchmarks for a while and i wonder if it can be that fast in real case senarios. Anyway thanks
3:40 Im quite surprised at the drop outs in rust availability. Despite Go having almost 10x as much latency, it has not dropped at all. This doesn't seem normal because why would 1 out of 50k requests just randomly fail? Might warrant further investigation imo.
*Edit: at 4:10 Rust drops 9 out of 90k requests, while Go still doesnt drop a single one. And at 4:30 Go drops its first request, while rust drops 21 out of 106k. Something hast to be wrong, otherwise 6:50 would not look this wierd.
What tool do you use to show these graphs? It looks very nice!
it looks like Prometheus/Grafana?
can you please do NodeJS vs PHP? let's finally end the argument
yes, but i need to test deno v2 first :)
@@AntonPutra okay thanks, we can wait until end of the month once NodeJS 22 becomes the official LTS. so that it becomes NodeJS 22 vs PHP 8.3. I'm also excited for the Deno 2 comparison :D
NodeJS and nginx+phpfpm have very different execution models, it wouldn't be a fair comparison. Comparing NodeJS with something like PHP Swoole would be a fairer comparison (both event-based asynchronous runtimes)
@@ziriusph3395 well, deno 2 is slower than the previous version unfortunately. But it is expected to improve in the future.
@@dansouza1623comparing to what most people use would be more fair. With php most people just deploy it using cpanel shared hosting, not a manual from scratch vps setup. But yeah comparing to php swoole would be interesting too.
That sad smiley face of Go at 6:18 made me laugh :))
if you look at it from the fair point even when golang is not doing any optimization hacks it's still keeping up a good rate. zzz uses io_uring under the hood so obviously it will be faster because there are less syscalls. I like to see how it compares with gnet in golang which also uses io_uring👍
I acknowledge that zzz could be faster than Rust from the start because it used io_uring as the runtime. I expect that changing the global allocator in Rust and switching to tokio-uring could lead to better performance.
thanks for bringing up gnet, i'll definitely try it out since they claim 'gnet is the fastest networking framework in Go.'
This kind of test is not very important to most real systems. To a few unique systems it can be crucial.
All the service does is return a string (not sure if it is static or not), which no real system does at high rate. I am pretty sure you can make a Rust version that would be as performant for this specific test (though I don't know Rust). It really matters what framework you use for such an a service.
On the other hand, if you add async complexity, where the service needs to perform other requests, your test becomes meaningless.
What you should really do instead is design a test where the service does some DB query. The results will be much different.
Better, if you can simulate some variance with some DB requests being slow on purpose, then measure the capacity (QPS) of each solution.
Can you do one video on how you setup and conduct these tests?
Anton, if do you can share the cost of the infras and the Benchmarks it would be amazing.
Почему-то мне кажется что раст и зиг так и останутся просто игрушками. С точки зрения количества спецов на рынке и перфоманса го это идеальный вариант.
I think there is a good idea to work with shared memory with multiprocessing. For example write and read data from cache upon hashmap + rwlock
you mean what zig has with zzz?
Awesome video, could you also make some comparassions with ruby on rails, i.e. ruby vs nodejs
yes, i'll do ruby on rails soon
I don't know much about rust and its frameworks, but is there a reason for choosing actix over axum?
yes, i did a benchmark in the past where actix performed better, but there is ntex, which i also need to test in the near future
axum is easier than actix in my opinion. in most benchmarks i've seen though actix outperforms axum.
I think this is a bit unfair to golang tbh. ZZZ is using io_uring instead of epoll which will significantly improve performance. Actix doesn't look like it's using it so kudos to rust for keeping up with a nice performance even without it. One "flaw" of the ZZZ framework it seems is not to provide the handler with a `std.io.Writer`, which means it could potentially outperform rust even more if it avoids this two-step process (write to function-local memory, then pass it on to the HTTP buffer), but I guess it could be hard to do that with io_uring? idk, but feels like a potential improvement there.
As for go, it seems to be stuck in the worst of all scenarios: Not using io_uring, allocating tons of memory *and* serializing json through reflection, but I guess that's the point of using the default library in go's case. I'd imagine a custom json encoder would easily skew the graphs for golang.. It really depends on how much one wants to refactor. If the goal is to deliver "regular joe's" kind of performance, maybe this is significant enough, though, again, it's a bit unfair that go doesn't do io_uring while zig does. However, if one wants to test highly optimized versions of each app then I assume going with the default golang library is not the best choice against a 45 star, 4 month old library crafted to be _the_ most performing zig HTTP server.
thanks! i appreciate your feedback! i'll do the best go frameworks vs the best rust frameworks, including fiber and ntex, soon
Please compare again this test!!!
Can you stop using the standard library of go ?
😂 i'll do the best golang frameworks vs the best rust frameworks soon
Probably a good rust pr will improve things on it's side
I got one for Actix with experimental support for io_uring - github.com/antonputra/tutorials/pull/311
Would you do ruby on rails vs python django? Api those interpreted languages that are not top of performance would be interesting
yes i'll do them soon
I dont think blurring helps since im 99% sure red is rust, blue is go and orange is zig 😂 The colors are matched too well
😊
nice video, is zig compiled in ReleaseSafe or ReleaseFast ?
ReleaseFast
You can see the PR where this code is submitted- it has bench figures for debug + safe + fast
Zig debug is a bit slower, zig safe is about 2-5% slower than fast .. doesn’t make a huge difference
Rust debug is significantly slower than zig debug mode
Rust release and zig fast are more or less equivalent in terms of memory safety. There is no transfer of ownership happening in these handlers, so the extra safety of the borrow checker isn’t coming into play here. The zig build has better memory leak safety than rust here, due to using arenas over RAII style memory cleanups
ReleaseFast
original pr - github.com/antonputra/tutorials/pull/280
source code for the video - github.com/antonputra/tutorials/tree/215/lessons/215
@@AntonPutra is client-side code available anywhere? looks very nice
not sure how to submit a pull request but something worth noting is if a function constructs a Device object the generated assembly has some lea instructions in it (according to godbolt with -O). conversely if u declare the device to be const, then only mov and movups instructions are used,, which could improve performance
thanks, in the real world, it will never be a const, right? but if you can create a PR, i would appreciate it -github.com/antonputra/tutorials
There is a new high-perf programming language called Vale. it's at the alpha stages just like Zig. Would you compare Zig and Vale?
спасибо за видео. Потестируй clojure and haskell and f# and gleam..elixir? erlang?
horosho, spasibo za feedback, sdelay skoro
@@AntonPutra тебя кстати prime посмотрел :)
Can you do a video on functional languages such as Ocaml vs F# vs Haskell vs Clojure vs Elixir?
I think it would be interesting for many.
please compare dart with golang
will do soon
@@AntonPutra thank you
No C benchmark?
what do you use to male those awesome charts?
prometheus + grafana
would like to see similar comparison between elixr, go, java, c#
ok will do!
Even though I love developing apps in Rust. I always see Zig will slightly be more performant than Rust since Zig is like the modern version of C.
Great content!
Thank you Beyonce!
Main takeaway from the results was that Rust and Zig are very close to each other though
thank you!
C, Rust, and Zig are all systems programming languages without GC etc. Barring compiler optimizations, there is no reason why any of them should be faster than the other. If you browse the results of the benchmarksgame, you will find plenty of Rust submissions that are faster than C and vice-versa.
Now we need a rust expert to redo the test! 🤣🤣
i'll do the best go frameworks vs the best rust frameworks, including fiber and ntex, soon
@@AntonPutra actix isn`t the best rust framework.
Why not use Axum instead of Actix? Axum is well maintained by the tokio team.
Based on my previous benchmark, Actix performed better. I'll try Ntex soon as well.
What do you use to setup dashboards and metrics collection? I can see that this is grafana, but do you have any guides how you set up clients?
i deploy prometheus using the prom operator and use grafana for visualization
@@AntonPutra Thank you for responding, I saw it in source code, but couldn’t find source code for “clients”, could you share it too or maybe give me a hint where it could be?
Would be instesting ktor vs spring both in kotlin
ok noted!
I am disappointed with go's performance.
i'll pick better frameworks next time maybe gnet or fiber
Elixir vs Go vs Java multicore pls
ok noted
What about the Elixir Phoenix tests? But in fact, it is much easier for him to work with persistent connections, like WebSocket, but it is still interesting to compare it with other high-level languages like Go or C# / Java. Ideally, when working on 2-4 threads
i'll do elixir soon, i promise
Maybe try C++ with Oat++, Drogon, CrowCpp
noted! i'll start c++ soon
No s3, no db queries this time?
my bad
cool!!!
can you check performance of MOJO vs ZIG
sure, will do in near future
Could you compare Rust vs NodeJS to motivate ppl to switch?
At this point, the question that stands is not really language vs. language, but implementation vs. implementation…
true
Hey dude, can you compare deno 2 with bun, please!! Also one comparison of Postgresql vs Surrealdb!!
Can these benchmarks feed back into improving the libraries?
maybe
Can you redo the Bun vs Go with multithreading on multiple CPUs? Also do check out Prime’s reaction.
yes, but first i'll do deno v2
@@AntonPutra Please use multithreading on multiple CPUs this time. You can also use web workers on JS side.
Do the lesser known like Scala, Crystal, Ballerina
ok, i'll try them, especially scala. i used it in the past to write some etl pipelines
Why does the cpu profile have downward spikes for zig and go but not for rust? What’s the behaviour difference, is this a difference in how tokio is scheduling work? 6:21
interesting, i hope some zig or go experts can explain
would it be easy to run this test with static cpu allocation on the kubernetes end?
Which tool you are using to show the metric?
Grafana
Elixir?
This would be awesome
soon
why not give two CPU cores to all these containers? Go suffers like that.
Also, awaiting Nim's video impatiently
Keep up the good work
i gave all containers 2 CPUs - github.com/antonputra/tutorials/blob/main/lessons/215/k8s/deploy/go-app/0-deployment.yaml#L37
Nice.
thanks!
wow zig 0.13 is close to rust in cpu usage from the beginning and more memory efficient for more requests what will it be after the V1
And i think they said zig is lower than c and closer to asm
please make vid about Swift (backend)
will do