Zap (Zig) vs Actix (Rust): Performance Benchmark in Kubernetes

  Рет қаралды 25,056

Anton Putra

Anton Putra

Күн бұрын

Пікірлер: 288
@AntonPutra
@AntonPutra 4 күн бұрын
👋What should I test next??? 🔴 UPDATED 🔴 - kzbin.info/www/bejne/iYOVfYWeo7Fkd7M 👉 [Playlist] New Benchmarks: kzbin.info/aero/PLiMWaCMwGJXmcDLvMQeORJ-j_jayKaLVn&si=p-UOaVM_6_SFx52H
@BarakaAndrew
@BarakaAndrew 4 күн бұрын
Zig vs Go
@picatchumm64
@picatchumm64 4 күн бұрын
Nomad (Hashicorp)
@CristianAndrei
@CristianAndrei 4 күн бұрын
actix (rust) vs salvo (rust)
@j-p-d-e-v
@j-p-d-e-v 4 күн бұрын
rust vs. go. vs. js vs php hehe
@AlexanderBorshak
@AlexanderBorshak 4 күн бұрын
Time of writing (creation) of a new web-service on Go, Rust and Zig.
@TheVachicorne
@TheVachicorne 4 күн бұрын
I looked at your dockerfile,. you are not testing a release build of Zig...
@AntonPutra
@AntonPutra 4 күн бұрын
I got 1 PR already, I'll collect all the tips I can, including pull requests, over the next 2 or 3 days and will release an updated video or a KZbin post with the results. github.com/antonputra/tutorials/pull/268
@ndykhng
@ndykhng 4 күн бұрын
Looking at the Dockerfile, you turned on release on Rust, but not on Zig! RUN cargo build --release versus RUN /opt/zig/zig build (missing -Doptimize=ReleaseFast here)
@mti2fw
@mti2fw 4 күн бұрын
Up!
@AntonPutra
@AntonPutra 4 күн бұрын
thanks for the tip, I already got 1 pull request - github.com/antonputra/tutorials/pull/268 I'll collect all the tips I can, including pull requests, over the next 2 or 3 days and will release an updated video or a KZbin post with the results.
@Hassibayub
@Hassibayub 4 күн бұрын
@@AntonPutra Make updated video
@TheAggressiveProgrammer
@TheAggressiveProgrammer 4 күн бұрын
Thanks, @ndykhng! The guy doesn't know how to compile Zig, compares apples with oranges, and obviously, it's Zig's fault. He has no idea how Zig works. He asks in the video if there is no garbage collection in Zig? Of course not. 🤦‍♂ I'm asking YT to not recommend this channel again. 👎 with no hesitation.
@sirnawaz
@sirnawaz 4 күн бұрын
Such a silly miss! Why would anyone trust this benchmark and the follow-on benchmark when you do not have the sense of doing the basic stuff!
@weiSane
@weiSane 4 күн бұрын
Yes. Man it’s like you read my mind. I was gonna suggest a comparison using zig.
@AntonPutra
@AntonPutra 4 күн бұрын
i may update results if i get enough tips to improve Zig code, i already got 1 PR - github.com/antonputra/tutorials/pull/268
@adho12
@adho12 4 күн бұрын
134K/s requests is pretty impressive
@AntonPutra
@AntonPutra 4 күн бұрын
160k max so far
@snippletrap
@snippletrap 4 күн бұрын
UCall Python library claims 210k requests/s
@dxlaam004
@dxlaam004 4 күн бұрын
​@@snippletrap who care?
@snippletrap
@snippletrap 4 күн бұрын
@@dxlaam004 Anyone who cares about server performance? Like the people who clicked on this video?
@danyael031
@danyael031 4 күн бұрын
​@@snippletrapucall is a python wrapper for a C/C++ implementation.
@romankoshchei
@romankoshchei 4 күн бұрын
Zig framework probably preallocates a bunch of memory to reduce allocations during runtime
@AntonPutra
@AntonPutra 4 күн бұрын
maybe
@ryanseipp6944
@ryanseipp6944 4 күн бұрын
Very cool! 130-160k rps on two cores is nuts. Glad you revamped the clients to generate enough load
@AntonPutra
@AntonPutra 4 күн бұрын
Yeah, I'm trying to improve each time
@krellin
@krellin 4 күн бұрын
we do almost 2 million TPS in HFT with java 8 lol on one core wire to wire measured (but yes we do not use retarded transport protocols or serialization formats so its not very fair) its just not impressive...
@ryanseipp6944
@ryanseipp6944 4 күн бұрын
@@krellin Congrats. That's impressive. Are you sure you're actually hitting the CPU core and not serving requests off FPGAs directly onto the wire? It's hard to imagine you could even get a handful of bytes on and off the NIC into a single CPU core at that rate.
@ryanseipp6944
@ryanseipp6944 4 күн бұрын
@@krellin You have a budget of 50ns at 2M rps. That's effectively 20 add instructions or a single L3 cache hit. That's not at all comparable to what the video is about. Both are impressive results in their own right. Yours in being able to pre-compute a response and program hardware to respond for you, and the video for processing a more reasonable workload on the fly, like the vast majority of companies rely on
@BosonCollider
@BosonCollider 4 күн бұрын
@@ryanseipp6944 Since he was talking about HFT I am assuming that he has some event driven system that processes 2 million events per second, which is fairly straightforward to do
@realoctavian
@realoctavian 4 күн бұрын
you should do Java & C# vs Golang. People say the two are as good as Golang is, but I'm not sure if that's true
@EzequielRegaldo
@EzequielRegaldo 3 күн бұрын
They are better
@realoctavian
@realoctavian 3 күн бұрын
@@EzequielRegaldo least delusional bytecode user
@AntonPutra
@AntonPutra 3 күн бұрын
ok, will do!
@EzequielRegaldo
@EzequielRegaldo 3 күн бұрын
@@realoctavian tested here and NET won by far
@vercelhater
@vercelhater 2 күн бұрын
@@EzequielRegaldo delusional
@massanchik
@massanchik 4 күн бұрын
Next logical step is Odin vs Rust :)
@AntonPutra
@AntonPutra 4 күн бұрын
🫡 😂
@germandavid2520
@germandavid2520 4 күн бұрын
I think Odin doesn't have a HTTP server yet.
@gearboxworks
@gearboxworks 3 күн бұрын
My takeaway from this is NOT to think Rust is so much better than Zig but to wonder what is wrong with Zap?
@AntonPutra
@AntonPutra 3 күн бұрын
i built it without additional optimization flags as suggested here - github.com/antonputra/tutorials/pull/268 i'll retest it again in a couple of days
@sirnawaz
@sirnawaz 4 күн бұрын
Your Zig is NOT optimized whereas you have used Rust in release mode. Such a silly miss! Why would anyone trust this benchmark and the follow-on benchmark when you do not have the sense of doing the basic stuff!
@steveoc64
@steveoc64 4 күн бұрын
I guess the existing bench is useful in showing how fully optimised Rust is able to hang in there with a debug mode Zig wrapper over an external C lib Should keep the video, but change the misleading title :) To give Anton credit where it’s due .. his devops skills are very excellent. That tutes repo is a great resource for learning more about k8s and Docker configs for different things Not necessarily the same skill set as programming
@AntonPutra
@AntonPutra 3 күн бұрын
will update the results in a couple of days, but i’ve only got this so far to optimize Zig. i hope it makes a big difference github.com/antonputra/tutorials/blob/main/lessons/207/zap-app/Dockerfile#L15C14-L15C23
@charliesta.abc123
@charliesta.abc123 4 күн бұрын
Hope rust loses, I'm not a fan of cults
@AntonPutra
@AntonPutra 3 күн бұрын
just merged the PR to optimize Zig and will rerun the test maybe tomorrow
@O...Maiden...O
@O...Maiden...O 2 күн бұрын
haha, it will still exist and grow, the loser is you 😂
@tacorevenge87
@tacorevenge87 4 күн бұрын
Great comparison as always. Would be good to compare rust vs c and c++
@AntonPutra
@AntonPutra 4 күн бұрын
thanks, yes will do. do you have any frameworks in mind?
@germandavid2520
@germandavid2520 4 күн бұрын
​@@AntonPutraThere is the framework Drogon for C++
@meuscc
@meuscc 4 күн бұрын
uwebsockts
@Bingo901
@Bingo901 4 күн бұрын
@@AntonPutramaybe you could try boost beast, though its pretty low level compared to other libraries
@ahmedgazy1425
@ahmedgazy1425 3 күн бұрын
​Yes dragon is a mysterious framework @@germandavid2520
@LtdJorge
@LtdJorge 4 күн бұрын
Rust and Zig are so unconstrained (same for C, C++, etc) that when doing benchmarks like these, it’s always a framework benchmark and not a language benchmark. Comparing slower languages, it is more of a language benchmark, for example boxing values in Python takes a big chunk of the total time. In Rust/Zig it’s more down to "does the framework allocate or not im this codepath" or "is the framework using a radix trie for matching URLs or something less efficient".
@AntonPutra
@AntonPutra 3 күн бұрын
agree, it is mostly frameworks, especially since zig is a wrapper around a c lib.
@uzaaft
@uzaaft 4 күн бұрын
Are you using ReleaseSafe or ReleaseFast for the zig build? Edit: The benchmark is inherently flawed, and shouldnt be trusted.
@uzaaft
@uzaaft 4 күн бұрын
After taking a look at the dockerfile, seems like you arent doing thing properly. The zig build should be: RUN /opt/zig/zig build -Doptimize=ReleaseFast
@AntonPutra
@AntonPutra 4 күн бұрын
Yes i got a PR already - github.com/antonputra/tutorials/pull/268 I'll collect all the tips I can, including pull requests, over the next 2 or 3 days and will release an updated video or a KZbin post with the results.
@uzaaft
@uzaaft 4 күн бұрын
@@AntonPutra thats me ;)
@anonymousalexander6005
@anonymousalexander6005 4 күн бұрын
@@AntonPutraYou should only use ReleaseFast if you wish to compare absolute performance. Production environments use ReleaseSafe, and that is what is most comparable to Rust implementation. I suspect the other PRs to be enough to make Zig competitive, but you might need to use different framework for Zig like Jetzig or Tokamak or custom implementation.
@anonymousalexander6005
@anonymousalexander6005 4 күн бұрын
@@uzaaftThe test is for production environment, ReleaseSafe is the proper release flag.
@AbdulRehman-pb5od
@AbdulRehman-pb5od 3 күн бұрын
Add external storage layer to make benchmark more realistic
@AntonPutra
@AntonPutra 3 күн бұрын
well, i'm not an expert in zig, if you can create a PR for zig, i'll take care of rust
@EightSixx
@EightSixx 3 күн бұрын
Hope we get an update on the Zig results when someone tells you whiy it might've failed :D
@AntonPutra
@AntonPutra 3 күн бұрын
yes, will update soon
@steveoc64
@steveoc64 4 күн бұрын
It’s hard to draw meaningful results out of micro benchmarks sometimes. Aside from the “/healthz” route, which is effectively hello world - most endpoints do significant work. It’s the “significant work” bit that shows how some languages and approaches are better or worse than others Not suggesting you expand your tests in that area, since the choice of “significant work” then becomes awfully subjective :) Even in this case here, it’s hard to say whether it’s handling IO vs json encoding that’s giving different results Maybe adding some complex endpoints that .. push a big struct of data through a template and output HTML or something Maybe decode a JWT too, as that can be CPU intensive and it should be super common
@AntonPutra
@AntonPutra 3 күн бұрын
ok, noted. i mean, i could potentially measure JSON serialization and other stuff, but i may end up with a lot of graphs. in other benchmarks, i also add the AWS SDK to upload files to S3 and Postgres. this benchmark was an exception because there aren't many SDKs for Zig :)
@steveoc64
@steveoc64 3 күн бұрын
@@AntonPutrafair call. Give us a lesson number that does the S3 and Postgres updates.. and will have a go at doing a (pure) zig version for you. The AWS updates have been messy since they have slowly been changing TLS versions over the last 12 months :) The Postgres libs are pretty solid now I’m not sure about the zap / debug build issue though, since it’s facil doing the actual work here .. the zig bits are just wrapping that. Changing optimisation mode might not end up changing much .. I’m not sure Probs best to start with a clean slate and do another different run using pure zig. (Will help out here) It’s early days still .. but keep in mind there are a lot of senior devs using zig for this sort of load already, and because it’s not as “mainstream” as other options- we need very good technical reasons to justify the risk. We are definitely getting good numbers - it would be great to see someone outside that community duplicate the results in their own setup Might take a bit of time over this and get it right. Zig being what it is, we kinda like taking our time vs knocking out quick hacks ;)
@AntonPutra
@AntonPutra 3 күн бұрын
@@steveoc64 that would be great! Here is go vs rust source code with s3 and postgres - github.com/antonputra/tutorials/tree/main/lessons/205 please use minio, you can run it locally using docker, also aws sdk needs to use "path" style - github.com/antonputra/tutorials/blob/main/lessons/205/go-app/config.yaml#L8 you can add zig verion to github.com/antonputra/tutorials/tree/main/lessons/207
@steveoc64
@steveoc64 3 күн бұрын
@@AntonPutra awesome! Thx PS: thanks for the docker file and tf setups too - devops is totally not my thing, and your repo has been super helpful for me ;)
@steveoc64
@steveoc64 3 күн бұрын
Q: what is the db schema ? Zig Postgres is pretty picky about getting types right (like uuid - you using the uuid ext or a text field ? etc)
@PouriyaJamshidi
@PouriyaJamshidi 4 күн бұрын
It would be nice to include Nim and its caprese framework. It currently sits at the top of web frameworks benchmark
@AntonPutra
@AntonPutra 3 күн бұрын
ok noted!
@mehdiboujid8761
@mehdiboujid8761 4 күн бұрын
This is very misleading, taking in consideration zig one is not running on release mode
@AntonPutra
@AntonPutra 4 күн бұрын
I got 1 PR already, I'll collect all the tips I can, including pull requests, over the next 2 or 3 days and will release an updated video or a KZbin post with the results. github.com/antonputra/tutorials/pull/268
@PanMaciek
@PanMaciek 4 күн бұрын
Can you possibly add some query parameters to the requests so the returned content is not static? I suspect that zig can compute the json at comptime and replace it with const slice in release build.
@AntonPutra
@AntonPutra 3 күн бұрын
i was thinking about it
@AntonPutra
@AntonPutra 4 күн бұрын
🔴IMPORTANT🔴 - For the next 2 or 3 days, I'll collect all the tips from Zig experts with optimization techniques. If it makes a significant difference, I'll release an updated video; if not, I'll just create a KZbin post with the results. UPDATED - kzbin.info/www/bejne/iYOVfYWeo7Fkd7M
@likwidsage
@likwidsage 4 күн бұрын
@@AntonPutra This is a great thought and it's fair by all accounts. I only fear that you may not get the same level of input as other communities. Not sure if there's anything to do about it though. Just pointing out what may be natural biases that exist due to culture and time.
@Dipj01
@Dipj01 4 күн бұрын
You should post this video in zig subreddit too. Will probably get helpful inputs there
@DevRJPro
@DevRJPro 4 күн бұрын
If you use Sonic-rs instead of Serde, you'll gain about ~20% in serialization and deserialization on Rust.
@AntonPutra
@AntonPutra 3 күн бұрын
thanks! i'll try it out
@nehjain
@nehjain 4 күн бұрын
Can you do rust(actix) vs nodejs(express) so I can convince my team and manager to use rust over nodejs 😅
@AntonPutra
@AntonPutra 3 күн бұрын
noted :)
@SergKoshelev
@SergKoshelev 4 күн бұрын
please try swift and vapor versus go. and whatever but I think vapor is like spring, because of this gin is the best candidates to compare
@AntonPutra
@AntonPutra 3 күн бұрын
ok will do
@sysInt64
@sysInt64 4 күн бұрын
Will be interesting to see comparison between Gleam, Rust and Go
@AntonPutra
@AntonPutra 3 күн бұрын
ok noted
@yuitachibana8829
@yuitachibana8829 Күн бұрын
After looking at zap vs actix, I would say Zig implementation is much "low level" than Rust ie. - Actix handles the routing for you while you hand write it in Zig. - In rust the serialization is done by the framework directly (with macro) but in Zig you manually allocate and call stringifyBuf. - In Zig, calling stringifyBuf could fail when the buffer overflow, this is not the same API parity with Rust which *practically* never fail. To make this fair, please update Zig implement to use a growable buffer or inline Rust json serialization to use array buffer. - Like other commenter have said, you forgot to use release mode in zig
@AntonPutra
@AntonPutra Күн бұрын
thank you! i just release a new video with updated results using all optimizations
@suryavirkapur
@suryavirkapur 4 күн бұрын
I don't think Zap is written from scratch in Zig. It binds to an underlying C library.
@AntonPutra
@AntonPutra 4 күн бұрын
yes, it is a wrapper around facil.io c lib
@lolilollolilol7773
@lolilollolilol7773 4 күн бұрын
He said it in the video. I agree it's not very meaningful if Zig is only a wrapper.
@johnballesteros8956
@johnballesteros8956 2 күн бұрын
Please try overhyped frameworks: nextjs/remix vs svelte vs qwik vs the fast frameworks: rust actix vs go fiber
@AntonPutra
@AntonPutra 2 күн бұрын
ok will do!
@curio78
@curio78 4 күн бұрын
I will run this rust setup against java/jee in standard server. Because we need a comparison with industry standard.
@AntonPutra
@AntonPutra 4 күн бұрын
sure, was thinking to include VM based results as well, maybe in the future
@gneryze
@gneryze 4 күн бұрын
Man, i really love your video! it give me exactly what i imagine of comparing and benchmarking two different language performance. i love to see if you also compare them with go!
@AntonPutra
@AntonPutra 3 күн бұрын
thanks will do at some point
@gneryze
@gneryze 2 күн бұрын
@@AntonPutra i watch your other video, i try to replicate the kubernetes monitoring but somehow i cannot make the cadvisor and prometheus showing my docker containers metrics. why? do you have video that do metrics but only for docker? no kubernetes ?
@AntonPutra
@AntonPutra 2 күн бұрын
@@gneryze double check metric names, sometimes they change names
@qb3661
@qb3661 4 күн бұрын
you didn't enable optimizations for zig
@AntonPutra
@AntonPutra 4 күн бұрын
Thanks! If you have any practical tips, flags I need to use, or options, please let me know. I'll collect all the tips I can, including pull requests, over the next 2 or 3 days and will release an updated video or a KZbin post with the results.
@tetuaoro
@tetuaoro 4 күн бұрын
Ok thank you for this video. So, waiting for the update with zig build release.
@AntonPutra
@AntonPutra 3 күн бұрын
yes soon
@Mr.BinarySniper
@Mr.BinarySniper 4 күн бұрын
Please please, compare the javascirpt runtimes. Bun vs Deno vs Node .. pleasee
@AntonPutra
@AntonPutra 3 күн бұрын
very soon :)
@mrpocock
@mrpocock 4 күн бұрын
Is the zap instance prealocating buffer and handler pools for requests? Is there another reason why it has such a comparatively large idle footprint?
@AntonPutra
@AntonPutra 4 күн бұрын
i got 1 PR - github.com/antonputra/tutorials/pull/268/files maybe with this optimization it will not allocate so much, will see in a couple of days
@TimSavage-drummer
@TimSavage-drummer 4 күн бұрын
It's running a debug build of zap. The results are meaningless.
@walidoutaleb7121
@walidoutaleb7121 2 күн бұрын
A lot of people complain that you are not using the languages the right way. I think it would be a good idea to consult with willing and knowledgeable people for each language. So that the programs are idiomatic and represent apps that you could see in he wild
@AntonPutra
@AntonPutra Күн бұрын
yes, after getting a lot of advice just released updated video
@javohirmirzo
@javohirmirzo 4 күн бұрын
another great comparison. thanks for the video
@AntonPutra
@AntonPutra 3 күн бұрын
my pleasure!
@DevRJPro
@DevRJPro 2 күн бұрын
I've seen the new results on the Git repository, there's a remark, for the same number of Req/s , actix sends more Bytes than Zig, so Zig sends requests with less complete metadata (headers) than Actix, so the test is flawed.
@AntonPutra
@AntonPutra Күн бұрын
yes, Actix send more headers
@PeterNirschl
@PeterNirschl 4 күн бұрын
Great analysis! Thank you
@AntonPutra
@AntonPutra 3 күн бұрын
thank you!!
@toriqahmad2401
@toriqahmad2401 3 күн бұрын
Do you have a tutorial how to setup a distributed database for horizontal scaling sir? Such as a mysql distributed database. I mean a cluster
@AntonPutra
@AntonPutra 3 күн бұрын
no, but there are some solutions like Citus that you can use out of the box
@nhwhn
@nhwhn 2 күн бұрын
awesome content, subscribed
@AntonPutra
@AntonPutra 2 күн бұрын
thank you!
@canofpulp
@canofpulp 4 күн бұрын
Im stuck at 1000 requests per second using axum
@AntonPutra
@AntonPutra 3 күн бұрын
it can do more :)
@andreujuanc
@andreujuanc 3 күн бұрын
It might sound stupid, but can you try Go vs Node in a AWS (DynamoDb) Scenario?
@AntonPutra
@AntonPutra 3 күн бұрын
sure will do in the future
@anvesh5377
@anvesh5377 4 күн бұрын
Next please do zig vs go
@AntonPutra
@AntonPutra 4 күн бұрын
yes will do, but first i need to wait for a couple of days to get optimization tips from Rust experts
@julienathomas7423
@julienathomas7423 3 күн бұрын
big fan of what you're doiing, i'm looking to do some benchmarks like this with my team and i was wondering what are you using for the client tests?
@AntonPutra
@AntonPutra 3 күн бұрын
a simple http client written in rust
@ethical-not-evil
@ethical-not-evil 4 күн бұрын
yo i'm learning phoenix these days and idk if it deserve it so if you could share a benchmark and thx.
@AntonPutra
@AntonPutra 3 күн бұрын
ok noted
@gadgetboyplaysmc
@gadgetboyplaysmc 4 күн бұрын
Gleam and Go please!
@AntonPutra
@AntonPutra 3 күн бұрын
ok noted
@dae2530
@dae2530 3 күн бұрын
i love your tests :)
@AntonPutra
@AntonPutra 3 күн бұрын
my pleasure :)
@ktappdev
@ktappdev 4 күн бұрын
I was expecting Rust to sweat here but maybe that Zap framework isn't good
@AntonPutra
@AntonPutra 4 күн бұрын
Collecting optimization tips from Zap (Zig) experts over the next couple of days, and I will release an updated video if there is a significant improvement, or just a KZbin post.
@anonymousalexander6005
@anonymousalexander6005 4 күн бұрын
Generally, you should expect to see C/Zig more niche optimizations, but Rust should be competitive with general usage. This test seems to show that the Zig implementation was flawed in some way, but that might be more fault of documentation than creator’s intent
@ristekostadinov2820
@ristekostadinov2820 4 күн бұрын
other people commented about zig not being compiled in release mode, expect Anton to re-do this video 😆😁
@BosonCollider
@BosonCollider 4 күн бұрын
Rust has an extremely mature asynchronous runtime, Zig doesn't exactly have concurrency as a core value proposition and it only promises to be a bit more convenient than C
@alekc7292
@alekc7292 4 күн бұрын
go next hell level: different rust vs c++ vs carbon?
@AntonPutra
@AntonPutra 3 күн бұрын
ok will do
@kartheeks4210
@kartheeks4210 4 күн бұрын
Great video! Can you share which tool do you use for your diagram animations?
@AntonPutra
@AntonPutra 3 күн бұрын
sure, adobe suite
@nordeenhasan6030
@nordeenhasan6030 Күн бұрын
is there any plan to do compare between Go fiber vs echo. will appreciate that.
@AntonPutra
@AntonPutra Күн бұрын
yes soon!
@walidoutaleb7121
@walidoutaleb7121 4 күн бұрын
isnt erlang exactly made for this type of work? it would be interesting to see results.
@AntonPutra
@AntonPutra 4 күн бұрын
I'll test it in the future
@OnFireByte
@OnFireByte 4 күн бұрын
It would get clapped by a lot of language in this test by a long short. Erlang, by it nature, isn't good at raw performance on limited single instance, but rather the scalability (both vertically and horizontally) that is crazy good.
@walidoutaleb7121
@walidoutaleb7121 4 күн бұрын
@@OnFireByte everybody know the BEAM vm isnt particularly performant i want to see how well it handles latency and how graciously it breaks down as you overload the system.
@metaltyphoon
@metaltyphoon 4 күн бұрын
Funny how the C# version here is faster than Go :D
@AntonPutra
@AntonPutra 3 күн бұрын
?
@metaltyphoon
@metaltyphoon 3 күн бұрын
@@AntonPutra 3:16 C# is > Go
@devjcarrillo
@devjcarrillo 2 күн бұрын
Actix (rust) vs uwebsockets (js/c++) Would be the only fair comparison if you want to compare JavaScript frameworks to Rust lol
@AntonPutra
@AntonPutra 2 күн бұрын
ok noted
@ibrahimmohammed3484
@ibrahimmohammed3484 4 күн бұрын
Omg this crab 🦀 is eating everything 😭
@RustIsWinning
@RustIsWinning 4 күн бұрын
Haha YES! 🦀🦀🦀
@AntonPutra
@AntonPutra 4 күн бұрын
😂
@skiesaboveunlimitedstargaz7316
@skiesaboveunlimitedstargaz7316 3 күн бұрын
So the trick that Zig is using is to use more CPU usage and use more memory... :)) that is not good.. Rust does not need more CPU and memory...
@AntonPutra
@AntonPutra 2 күн бұрын
i'll release updated video in a day with all optimizations on zig side
@likwidsage
@likwidsage 4 күн бұрын
My assumption here is this like the initial Go vs Rust where Go won. The biggest difference might end up being that you won't have zig experts come to tell you how you can improve it as it's still a very young language.
@AntonPutra
@AntonPutra 4 күн бұрын
Agree! Thanks! I'll collect all the tips I can, including pull requests, over the next 2 or 3 days and will release an updated video or a KZbin post with the results.
@mti2fw
@mti2fw 4 күн бұрын
Nice idea!
@JacekWojtkowski
@JacekWojtkowski 4 күн бұрын
Here's an idea. It would be cool if you compared Rust with V lang.
@AntonPutra
@AntonPutra 3 күн бұрын
ok interesting
@binlux
@binlux 4 күн бұрын
you are comparing frameworks not languages
@AntonPutra
@AntonPutra 4 күн бұрын
yes
@AlexanderBorshak
@AlexanderBorshak 4 күн бұрын
Maybe Zig allocated all required memory just once, and not performing re-allocation later? (To the question, why Rust using less when 1 MB, and Zig - 22,5 MB.)
@AntonPutra
@AntonPutra 4 күн бұрын
Maybe I'll wait for the Zig experts with optimization tips, and I'll update the results if there is a significant difference, or I'll just create a KZbin post.
@ЕвгенийКрасилов-о9о
@ЕвгенийКрасилов-о9о 4 күн бұрын
У зига стабильная версия 0.13 вроде? Учитывая состояние документации и новизну языка, вполне себе хорошие результаты. Единственное что странно - использование памяти. Скорее всего "skill issue", но типа это не в упрёк, ты итак пишешь на куче языков, надеюсь, знающие зиг люди помогут хорошими коммитами =)
@AntonPutra
@AntonPutra 4 күн бұрын
one govorya 0.13 is stale, so they suggest to use latest master - github.com/antonputra/tutorials/blob/main/lessons/207/zap-app/Dockerfile#L3 I'll collect all the tips I can, including pull requests, over the next 2 or 3 days and will release an updated video or a KZbin post with the results.
@limplash
@limplash 3 күн бұрын
One important thing to note here is that Zig is not async hence must be using a thread pool, An async runtime has been proven to be more performant, using lesser resources and handle more concurrent connections.
@AntonPutra
@AntonPutra 3 күн бұрын
is there anything i can do to improve Zig performance? more threads? container only see 1 core (2 vCPU)
@Tszyu01
@Tszyu01 4 күн бұрын
You should consider doing a test against gleam lang at some point.
@AntonPutra
@AntonPutra 3 күн бұрын
ok, noted! never heard about gleam before
@steveoc64
@steveoc64 3 күн бұрын
@@AntonPutra it compiles to Erlang and runs on the BEAM VM If you did Erlang vs Elixir vs Gleam - should expect almost identical results
@StingSting844
@StingSting844 4 күн бұрын
Is the zig version using a bit more memory because of arena allocation or something?
@AntonPutra
@AntonPutra 4 күн бұрын
interesting, i use the latest version - github.com/antonputra/tutorials/blob/main/lessons/207/zap-app/Dockerfile#L3
@Dipj01
@Dipj01 4 күн бұрын
Please do a laravel vs express video
@AntonPutra
@AntonPutra 4 күн бұрын
ok soon
@youraccountissuspended
@youraccountissuspended 4 күн бұрын
your laravel will got beaten by express easily
@W0rldBr3aker
@W0rldBr3aker 4 күн бұрын
Wow, expected absolutely different results, looks like indeed Zap is too young to compete 😅
@AntonPutra
@AntonPutra 4 күн бұрын
I'll collect all the tips I can, including pull requests, over the next 2 or 3 days and will release an updated video or a KZbin post with the results.
@ferdynandkiepski5026
@ferdynandkiepski5026 4 күн бұрын
Looking at the benchmarks it seems that you should set a standard for optimizations for the comparison to be fair. Obviously ideally you want to be using PGO but not all compilers have easy support for that. So I think a default of the highest optimization setting that doesn't break fp math, (as in no -Ofast or -ffast-math) so in the case of gcc/clang that would be -O3 combined with true link time optimizations would be a sane default. Not sure if you set true LTO for rust this time, so as rust by default doesn't optimize across crate boundaries this could be losing performance. To summarise LTO + O3 would be sane. Along with building for the architecture of the server you are running on (-march and -mtune equivalents). Edit: I see that you already set lto to true in rust and panic to abort.
@ferdynandkiepski5026
@ferdynandkiepski5026 4 күн бұрын
​​@@anonymousalexander6005You would be surprised. LTO is not niche and should be a default. In terms of PGO what it does is it allows the compiler to know what are the hot paths in the code. Depending on the application PGO could even yield 10% performance or more. Getting around 5-10% is not uncommon. This is talking about recent clang and LLVM 18 and above. The compiler without LTO is only able to guess as to what the correct path to inline is, or if some loop gets called enough to be worth vectorizing or unrolling.
@ferdynandkiepski5026
@ferdynandkiepski5026 4 күн бұрын
​@@anonymousalexander6005You would be surprised. LTO is not niche and should be a default. In terms of PGO what it does is it allows the compiler to know what are the hot paths in the code. Depending on the application PGO could even yield 10% performance or more. Getting around 5-10% is not uncommon. This is talking about recent LLVM 18 and above. The compiler without LTO is only able to guess as to what the correct path to inline is, or if some loop gets called enough to be worth vectorizing or unrolling.
@AntonPutra
@AntonPutra 3 күн бұрын
thanks for the feedback and yes i used lto for Rust - github.com/antonputra/tutorials/blob/main/lessons/207/actix-app/Cargo.toml#L11
@salim444
@salim444 4 күн бұрын
that thumbnail could give you trouble with the german authority so be careful. But cool video and as others mentioned zig should compile with releasefast
@berserk.4121
@berserk.4121 4 күн бұрын
Why?
@salim444
@salim444 4 күн бұрын
@@berserk.4121 they banned the use of red triangle and especially and upsidedown one
@AntonPutra
@AntonPutra 4 күн бұрын
haha i didn't know
@AntonPutra
@AntonPutra 4 күн бұрын
Also, regarding Zig, I'll collect all the tips I can, including pull requests, over the next 2 or 3 days and will release an updated video or a KZbin post with the results.
@mti2fw
@mti2fw 4 күн бұрын
​@@salim444why?
@alexeydmitrievich5970
@alexeydmitrievich5970 4 күн бұрын
Nice video🎉
@AntonPutra
@AntonPutra 3 күн бұрын
thank you!
@zendr0
@zendr0 4 күн бұрын
130K req/s - impressive
@AntonPutra
@AntonPutra 4 күн бұрын
160k actually :)
@zendr0
@zendr0 4 күн бұрын
@@AntonPutra right. That's insane
@zahash1045
@zahash1045 4 күн бұрын
Common rust W
@vercolit
@vercolit 4 күн бұрын
Rust wins ... against an unoptimised release lol
@AntonPutra
@AntonPutra 4 күн бұрын
I'll collect all the tips I can, including pull requests, over the next 2 or 3 days and will release an updated video or a KZbin post with the results.
@DooMWhite
@DooMWhite 4 күн бұрын
@@vercolit Literally a debug build
@hiddenni
@hiddenni Күн бұрын
anyone know a good resource to learn zig?
@AntonPutra
@AntonPutra Күн бұрын
this one is pretty good - zig.guide/
@nabinsaud4688
@nabinsaud4688 4 күн бұрын
Can you do a bench mark on nodejs nestjs vs golang
@AntonPutra
@AntonPutra 3 күн бұрын
yes soon
@JoanMontes-r2b
@JoanMontes-r2b 10 сағат бұрын
Anderson Amy Clark Cynthia Gonzalez Maria
@AntonPutra
@AntonPutra 9 сағат бұрын
?
@funnynews341
@funnynews341 3 күн бұрын
well, thank you for your infomation, i am learning Rust, but i got advertising from zig that they said Zig is faster than Rust, it make confuse, but now i known Rust is faster and more stable
@AntonPutra
@AntonPutra 3 күн бұрын
waiting for the optimization tips... will update in couple of days
@TheSergWolf
@TheSergWolf 4 күн бұрын
Oherenchick ! krasavo
@AntonPutra
@AntonPutra 3 күн бұрын
haha
@z_YouCef_w
@z_YouCef_w 4 күн бұрын
Pls can u tell me how i can create benchmark like this
@AntonPutra
@AntonPutra 3 күн бұрын
well i have a lot of tutorials on my channel how to monitor containers with prometheus and grafana one of them - github.com/antonputra/tutorials/tree/main/lessons/135
@Singlton
@Singlton 4 күн бұрын
So rust is better?
@AntonPutra
@AntonPutra 3 күн бұрын
idk yet, i got some tips to improve zig, will rerun the test in a day or two
@apidas
@apidas 4 күн бұрын
man, rust is killing it
@pietraderdetective8953
@pietraderdetective8953 3 күн бұрын
Rust on Release build, ZigZap on Debug build. The update video should be interesting!
@AntonPutra
@AntonPutra 3 күн бұрын
yes will release updated video, but how come "./zig build" defaults to debug? it's a bit confusing updated - github.com/antonputra/tutorials/blob/main/lessons/207/zap-app/Dockerfile#L15C14-L15C23
@bo_leang
@bo_leang 3 күн бұрын
Rust powerful 😂
@AntonPutra
@AntonPutra 3 күн бұрын
will see
@ranggatohjaya
@ranggatohjaya 4 күн бұрын
First comment, wow long awaited for this😊
@AntonPutra
@AntonPutra 4 күн бұрын
😊
@GigachadRustacean-lu8bo
@GigachadRustacean-lu8bo 4 күн бұрын
i notice zap kinda performs bad so bad it think zap either performs head to head or better at least
@pietraderdetective8953
@pietraderdetective8953 3 күн бұрын
Zap was running on Debug build, while Actix on Release build. The table should be turned upside down once it's fixed.
@AntonPutra
@AntonPutra 3 күн бұрын
well, i wouldn't say that i built it in debug mode - github.com/antonputra/tutorials/blob/main/lessons/207/zap-app/Dockerfile#L15 but i get your point and will rerun the test with some optimizations, including this - github.com/antonputra/tutorials/pull/268
AI can't cross this line and we don't know why.
24:07
Welch Labs
Рет қаралды 575 М.
The CUTEST flower girl on YouTube (2019-2024)
00:10
Hungry FAM
Рет қаралды 50 МЛН
Bend The Impossible Bar Win $1,000
00:57
Stokes Twins
Рет қаралды 49 МЛН
No, Einstein Didn’t Solve the Biggest Problem in Physics
8:04
Sabine Hossenfelder
Рет қаралды 173 М.
I Made The Ultimate Cheating Device
9:39
ChromaLock
Рет қаралды 561 М.
How 3 Phase Power works: why 3 phases?
14:41
The Engineering Mindset
Рет қаралды 1 МЛН
I Hacked Diablo II To Use Modern Graphics
13:16
Nathan Baggs
Рет қаралды 138 М.
Traefik vs. Nginx performance benchmark
12:38
Anton Putra
Рет қаралды 43 М.
Why I Chose Rust Over Zig
33:18
ThePrimeTime
Рет қаралды 173 М.
CLIs Are Making A Comeback
53:54
ThePrimeTime
Рет қаралды 127 М.
Microservices Gone Wrong at DoorDash
17:22
NeetCodeIO
Рет қаралды 58 М.
I forced EVERYONE to use Linux
22:59
NetworkChuck
Рет қаралды 542 М.
The CUTEST flower girl on YouTube (2019-2024)
00:10
Hungry FAM
Рет қаралды 50 МЛН