👋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
@BarakaAndrew4 күн бұрын
Zig vs Go
@picatchumm644 күн бұрын
Nomad (Hashicorp)
@CristianAndrei4 күн бұрын
actix (rust) vs salvo (rust)
@j-p-d-e-v4 күн бұрын
rust vs. go. vs. js vs php hehe
@AlexanderBorshak4 күн бұрын
Time of writing (creation) of a new web-service on Go, Rust and Zig.
@TheVachicorne4 күн бұрын
I looked at your dockerfile,. you are not testing a release build of Zig...
@AntonPutra4 күн бұрын
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
@ndykhng4 күн бұрын
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)
@mti2fw4 күн бұрын
Up!
@AntonPutra4 күн бұрын
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.
@Hassibayub4 күн бұрын
@@AntonPutra Make updated video
@TheAggressiveProgrammer4 күн бұрын
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.
@sirnawaz4 күн бұрын
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!
@weiSane4 күн бұрын
Yes. Man it’s like you read my mind. I was gonna suggest a comparison using zig.
@AntonPutra4 күн бұрын
i may update results if i get enough tips to improve Zig code, i already got 1 PR - github.com/antonputra/tutorials/pull/268
@adho124 күн бұрын
134K/s requests is pretty impressive
@AntonPutra4 күн бұрын
160k max so far
@snippletrap4 күн бұрын
UCall Python library claims 210k requests/s
@dxlaam0044 күн бұрын
@@snippletrap who care?
@snippletrap4 күн бұрын
@@dxlaam004 Anyone who cares about server performance? Like the people who clicked on this video?
@danyael0314 күн бұрын
@@snippletrapucall is a python wrapper for a C/C++ implementation.
@romankoshchei4 күн бұрын
Zig framework probably preallocates a bunch of memory to reduce allocations during runtime
@AntonPutra4 күн бұрын
maybe
@ryanseipp69444 күн бұрын
Very cool! 130-160k rps on two cores is nuts. Glad you revamped the clients to generate enough load
@AntonPutra4 күн бұрын
Yeah, I'm trying to improve each time
@krellin4 күн бұрын
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...
@ryanseipp69444 күн бұрын
@@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.
@ryanseipp69444 күн бұрын
@@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
@BosonCollider4 күн бұрын
@@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
@realoctavian4 күн бұрын
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
@EzequielRegaldo3 күн бұрын
They are better
@realoctavian3 күн бұрын
@@EzequielRegaldo least delusional bytecode user
@AntonPutra3 күн бұрын
ok, will do!
@EzequielRegaldo3 күн бұрын
@@realoctavian tested here and NET won by far
@vercelhater2 күн бұрын
@@EzequielRegaldo delusional
@massanchik4 күн бұрын
Next logical step is Odin vs Rust :)
@AntonPutra4 күн бұрын
🫡 😂
@germandavid25204 күн бұрын
I think Odin doesn't have a HTTP server yet.
@gearboxworks3 күн бұрын
My takeaway from this is NOT to think Rust is so much better than Zig but to wonder what is wrong with Zap?
@AntonPutra3 күн бұрын
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
@sirnawaz4 күн бұрын
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!
@steveoc644 күн бұрын
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
@AntonPutra3 күн бұрын
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.abc1234 күн бұрын
Hope rust loses, I'm not a fan of cults
@AntonPutra3 күн бұрын
just merged the PR to optimize Zig and will rerun the test maybe tomorrow
@O...Maiden...O2 күн бұрын
haha, it will still exist and grow, the loser is you 😂
@tacorevenge874 күн бұрын
Great comparison as always. Would be good to compare rust vs c and c++
@AntonPutra4 күн бұрын
thanks, yes will do. do you have any frameworks in mind?
@germandavid25204 күн бұрын
@@AntonPutraThere is the framework Drogon for C++
@meuscc4 күн бұрын
uwebsockts
@Bingo9014 күн бұрын
@@AntonPutramaybe you could try boost beast, though its pretty low level compared to other libraries
@ahmedgazy14253 күн бұрын
Yes dragon is a mysterious framework @@germandavid2520
@LtdJorge4 күн бұрын
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".
@AntonPutra3 күн бұрын
agree, it is mostly frameworks, especially since zig is a wrapper around a c lib.
@uzaaft4 күн бұрын
Are you using ReleaseSafe or ReleaseFast for the zig build? Edit: The benchmark is inherently flawed, and shouldnt be trusted.
@uzaaft4 күн бұрын
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
@AntonPutra4 күн бұрын
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.
@uzaaft4 күн бұрын
@@AntonPutra thats me ;)
@anonymousalexander60054 күн бұрын
@@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.
@anonymousalexander60054 күн бұрын
@@uzaaftThe test is for production environment, ReleaseSafe is the proper release flag.
@AbdulRehman-pb5od3 күн бұрын
Add external storage layer to make benchmark more realistic
@AntonPutra3 күн бұрын
well, i'm not an expert in zig, if you can create a PR for zig, i'll take care of rust
@EightSixx3 күн бұрын
Hope we get an update on the Zig results when someone tells you whiy it might've failed :D
@AntonPutra3 күн бұрын
yes, will update soon
@steveoc644 күн бұрын
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
@AntonPutra3 күн бұрын
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 :)
@steveoc643 күн бұрын
@@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 ;)
@AntonPutra3 күн бұрын
@@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
@steveoc643 күн бұрын
@@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 ;)
@steveoc643 күн бұрын
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)
@PouriyaJamshidi4 күн бұрын
It would be nice to include Nim and its caprese framework. It currently sits at the top of web frameworks benchmark
@AntonPutra3 күн бұрын
ok noted!
@mehdiboujid87614 күн бұрын
This is very misleading, taking in consideration zig one is not running on release mode
@AntonPutra4 күн бұрын
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
@PanMaciek4 күн бұрын
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.
@AntonPutra3 күн бұрын
i was thinking about it
@AntonPutra4 күн бұрын
🔴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
@likwidsage4 күн бұрын
@@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.
@Dipj014 күн бұрын
You should post this video in zig subreddit too. Will probably get helpful inputs there
@DevRJPro4 күн бұрын
If you use Sonic-rs instead of Serde, you'll gain about ~20% in serialization and deserialization on Rust.
@AntonPutra3 күн бұрын
thanks! i'll try it out
@nehjain4 күн бұрын
Can you do rust(actix) vs nodejs(express) so I can convince my team and manager to use rust over nodejs 😅
@AntonPutra3 күн бұрын
noted :)
@SergKoshelev4 күн бұрын
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
@AntonPutra3 күн бұрын
ok will do
@sysInt644 күн бұрын
Will be interesting to see comparison between Gleam, Rust and Go
@AntonPutra3 күн бұрын
ok noted
@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Күн бұрын
thank you! i just release a new video with updated results using all optimizations
@suryavirkapur4 күн бұрын
I don't think Zap is written from scratch in Zig. It binds to an underlying C library.
@AntonPutra4 күн бұрын
yes, it is a wrapper around facil.io c lib
@lolilollolilol77734 күн бұрын
He said it in the video. I agree it's not very meaningful if Zig is only a wrapper.
@johnballesteros89562 күн бұрын
Please try overhyped frameworks: nextjs/remix vs svelte vs qwik vs the fast frameworks: rust actix vs go fiber
@AntonPutra2 күн бұрын
ok will do!
@curio784 күн бұрын
I will run this rust setup against java/jee in standard server. Because we need a comparison with industry standard.
@AntonPutra4 күн бұрын
sure, was thinking to include VM based results as well, maybe in the future
@gneryze4 күн бұрын
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!
@AntonPutra3 күн бұрын
thanks will do at some point
@gneryze2 күн бұрын
@@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 ?
@AntonPutra2 күн бұрын
@@gneryze double check metric names, sometimes they change names
@qb36614 күн бұрын
you didn't enable optimizations for zig
@AntonPutra4 күн бұрын
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.
@tetuaoro4 күн бұрын
Ok thank you for this video. So, waiting for the update with zig build release.
@AntonPutra3 күн бұрын
yes soon
@Mr.BinarySniper4 күн бұрын
Please please, compare the javascirpt runtimes. Bun vs Deno vs Node .. pleasee
@AntonPutra3 күн бұрын
very soon :)
@mrpocock4 күн бұрын
Is the zap instance prealocating buffer and handler pools for requests? Is there another reason why it has such a comparatively large idle footprint?
@AntonPutra4 күн бұрын
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-drummer4 күн бұрын
It's running a debug build of zap. The results are meaningless.
@walidoutaleb71212 күн бұрын
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Күн бұрын
yes, after getting a lot of advice just released updated video
@javohirmirzo4 күн бұрын
another great comparison. thanks for the video
@AntonPutra3 күн бұрын
my pleasure!
@DevRJPro2 күн бұрын
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Күн бұрын
yes, Actix send more headers
@PeterNirschl4 күн бұрын
Great analysis! Thank you
@AntonPutra3 күн бұрын
thank you!!
@toriqahmad24013 күн бұрын
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
@AntonPutra3 күн бұрын
no, but there are some solutions like Citus that you can use out of the box
@nhwhn2 күн бұрын
awesome content, subscribed
@AntonPutra2 күн бұрын
thank you!
@canofpulp4 күн бұрын
Im stuck at 1000 requests per second using axum
@AntonPutra3 күн бұрын
it can do more :)
@andreujuanc3 күн бұрын
It might sound stupid, but can you try Go vs Node in a AWS (DynamoDb) Scenario?
@AntonPutra3 күн бұрын
sure will do in the future
@anvesh53774 күн бұрын
Next please do zig vs go
@AntonPutra4 күн бұрын
yes will do, but first i need to wait for a couple of days to get optimization tips from Rust experts
@julienathomas74233 күн бұрын
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?
@AntonPutra3 күн бұрын
a simple http client written in rust
@ethical-not-evil4 күн бұрын
yo i'm learning phoenix these days and idk if it deserve it so if you could share a benchmark and thx.
@AntonPutra3 күн бұрын
ok noted
@gadgetboyplaysmc4 күн бұрын
Gleam and Go please!
@AntonPutra3 күн бұрын
ok noted
@dae25303 күн бұрын
i love your tests :)
@AntonPutra3 күн бұрын
my pleasure :)
@ktappdev4 күн бұрын
I was expecting Rust to sweat here but maybe that Zap framework isn't good
@AntonPutra4 күн бұрын
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.
@anonymousalexander60054 күн бұрын
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
@ristekostadinov28204 күн бұрын
other people commented about zig not being compiled in release mode, expect Anton to re-do this video 😆😁
@BosonCollider4 күн бұрын
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
@alekc72924 күн бұрын
go next hell level: different rust vs c++ vs carbon?
@AntonPutra3 күн бұрын
ok will do
@kartheeks42104 күн бұрын
Great video! Can you share which tool do you use for your diagram animations?
@AntonPutra3 күн бұрын
sure, adobe suite
@nordeenhasan6030Күн бұрын
is there any plan to do compare between Go fiber vs echo. will appreciate that.
@AntonPutraКүн бұрын
yes soon!
@walidoutaleb71214 күн бұрын
isnt erlang exactly made for this type of work? it would be interesting to see results.
@AntonPutra4 күн бұрын
I'll test it in the future
@OnFireByte4 күн бұрын
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.
@walidoutaleb71214 күн бұрын
@@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.
@metaltyphoon4 күн бұрын
Funny how the C# version here is faster than Go :D
@AntonPutra3 күн бұрын
?
@metaltyphoon3 күн бұрын
@@AntonPutra 3:16 C# is > Go
@devjcarrillo2 күн бұрын
Actix (rust) vs uwebsockets (js/c++) Would be the only fair comparison if you want to compare JavaScript frameworks to Rust lol
@AntonPutra2 күн бұрын
ok noted
@ibrahimmohammed34844 күн бұрын
Omg this crab 🦀 is eating everything 😭
@RustIsWinning4 күн бұрын
Haha YES! 🦀🦀🦀
@AntonPutra4 күн бұрын
😂
@skiesaboveunlimitedstargaz73163 күн бұрын
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...
@AntonPutra2 күн бұрын
i'll release updated video in a day with all optimizations on zig side
@likwidsage4 күн бұрын
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.
@AntonPutra4 күн бұрын
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.
@mti2fw4 күн бұрын
Nice idea!
@JacekWojtkowski4 күн бұрын
Here's an idea. It would be cool if you compared Rust with V lang.
@AntonPutra3 күн бұрын
ok interesting
@binlux4 күн бұрын
you are comparing frameworks not languages
@AntonPutra4 күн бұрын
yes
@AlexanderBorshak4 күн бұрын
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.)
@AntonPutra4 күн бұрын
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о4 күн бұрын
У зига стабильная версия 0.13 вроде? Учитывая состояние документации и новизну языка, вполне себе хорошие результаты. Единственное что странно - использование памяти. Скорее всего "skill issue", но типа это не в упрёк, ты итак пишешь на куче языков, надеюсь, знающие зиг люди помогут хорошими коммитами =)
@AntonPutra4 күн бұрын
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.
@limplash3 күн бұрын
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.
@AntonPutra3 күн бұрын
is there anything i can do to improve Zig performance? more threads? container only see 1 core (2 vCPU)
@Tszyu014 күн бұрын
You should consider doing a test against gleam lang at some point.
@AntonPutra3 күн бұрын
ok, noted! never heard about gleam before
@steveoc643 күн бұрын
@@AntonPutra it compiles to Erlang and runs on the BEAM VM If you did Erlang vs Elixir vs Gleam - should expect almost identical results
@StingSting8444 күн бұрын
Is the zig version using a bit more memory because of arena allocation or something?
@AntonPutra4 күн бұрын
interesting, i use the latest version - github.com/antonputra/tutorials/blob/main/lessons/207/zap-app/Dockerfile#L3
@Dipj014 күн бұрын
Please do a laravel vs express video
@AntonPutra4 күн бұрын
ok soon
@youraccountissuspended4 күн бұрын
your laravel will got beaten by express easily
@W0rldBr3aker4 күн бұрын
Wow, expected absolutely different results, looks like indeed Zap is too young to compete 😅
@AntonPutra4 күн бұрын
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.
@ferdynandkiepski50264 күн бұрын
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.
@ferdynandkiepski50264 күн бұрын
@@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.
@ferdynandkiepski50264 күн бұрын
@@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.
@AntonPutra3 күн бұрын
thanks for the feedback and yes i used lto for Rust - github.com/antonputra/tutorials/blob/main/lessons/207/actix-app/Cargo.toml#L11
@salim4444 күн бұрын
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.41214 күн бұрын
Why?
@salim4444 күн бұрын
@@berserk.4121 they banned the use of red triangle and especially and upsidedown one
@AntonPutra4 күн бұрын
haha i didn't know
@AntonPutra4 күн бұрын
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.
@mti2fw4 күн бұрын
@@salim444why?
@alexeydmitrievich59704 күн бұрын
Nice video🎉
@AntonPutra3 күн бұрын
thank you!
@zendr04 күн бұрын
130K req/s - impressive
@AntonPutra4 күн бұрын
160k actually :)
@zendr04 күн бұрын
@@AntonPutra right. That's insane
@zahash10454 күн бұрын
Common rust W
@vercolit4 күн бұрын
Rust wins ... against an unoptimised release lol
@AntonPutra4 күн бұрын
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.
@DooMWhite4 күн бұрын
@@vercolit Literally a debug build
@hiddenniКүн бұрын
anyone know a good resource to learn zig?
@AntonPutraКүн бұрын
this one is pretty good - zig.guide/
@nabinsaud46884 күн бұрын
Can you do a bench mark on nodejs nestjs vs golang
@AntonPutra3 күн бұрын
yes soon
@JoanMontes-r2b10 сағат бұрын
Anderson Amy Clark Cynthia Gonzalez Maria
@AntonPutra9 сағат бұрын
?
@funnynews3413 күн бұрын
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
@AntonPutra3 күн бұрын
waiting for the optimization tips... will update in couple of days
@TheSergWolf4 күн бұрын
Oherenchick ! krasavo
@AntonPutra3 күн бұрын
haha
@z_YouCef_w4 күн бұрын
Pls can u tell me how i can create benchmark like this
@AntonPutra3 күн бұрын
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
@Singlton4 күн бұрын
So rust is better?
@AntonPutra3 күн бұрын
idk yet, i got some tips to improve zig, will rerun the test in a day or two
@apidas4 күн бұрын
man, rust is killing it
@pietraderdetective89533 күн бұрын
Rust on Release build, ZigZap on Debug build. The update video should be interesting!
@AntonPutra3 күн бұрын
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_leang3 күн бұрын
Rust powerful 😂
@AntonPutra3 күн бұрын
will see
@ranggatohjaya4 күн бұрын
First comment, wow long awaited for this😊
@AntonPutra4 күн бұрын
😊
@GigachadRustacean-lu8bo4 күн бұрын
i notice zap kinda performs bad so bad it think zap either performs head to head or better at least
@pietraderdetective89533 күн бұрын
Zap was running on Debug build, while Actix on Release build. The table should be turned upside down once it's fixed.
@AntonPutra3 күн бұрын
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