Go is blazingly faster than Zig?

Поділитися
Вставка
  • Опубліковано 13 січ 2025

КОМЕНТАРІ • 697

  • @ThePrimeagen
    @ThePrimeagen  2 роки тому +473

    These Blazingly Fast Videos have been fun to make. Should I keep going? Should we keep making more?
    Also, we are SOOOO close to 100k subs, what should we do to celebrate?

    • @jonathanalonso6492
      @jonathanalonso6492 2 роки тому +15

      Write your own UI framework; call it "SmoothBrainJS".
      As for the catchline? _Blazingly fast_

    • @armandsalle8447
      @armandsalle8447 2 роки тому +6

      YES keep going please! That's so fun! Thank you for your content ❤

    • @armandsalle8447
      @armandsalle8447 2 роки тому

      Also, nice moustache 🇫🇷🥖

    • @iduran
      @iduran 2 роки тому +4

      Yes please. Do one on Carbon!

    • @zeebs7163
      @zeebs7163 2 роки тому

      we should do a celebration, BLAZINGLYYYY FASTTTT!!

  • @Tesserakt8
    @Tesserakt8 2 роки тому +764

    I now can't look at framework repos and not laugh when I see blazingly fast.

    • @ThePrimeagen
      @ThePrimeagen  2 роки тому +197

      that was a goal

    • @miku4j
      @miku4j 2 роки тому +3

      me too

    • @Mempler
      @Mempler 2 роки тому +4

      @@mateusramos1742 the question is, does it "cheat" and interop with C/++/rust/zig or is it purely written in go?

    • @mateusramos1742
      @mateusramos1742 2 роки тому +2

      @@Mempler purely written in go.

    • @whoami5955
      @whoami5955 Рік тому +4

      Blazing fast

  • @striderstache99
    @striderstache99 2 роки тому +93

    You and Fireship are my favorite code content creators. Funny and thorough. Need more of this on UA-cam.

  • @DiegoVallejoDev
    @DiegoVallejoDev 2 роки тому +206

    As a professional node developer I 100% agree, Node is not meant to be super fast and be used on the most crowded/critical endpoints of the application, it has more to do with fullstack's fairly new role in the industry.
    In the old days companies had front-end and back-end teams that probably never met each other, they would have an internal documentation site with most of the information they needed and at the last steps of the waterfall chain the software it will run mostly fine, but we're talking months of development with no progress being seen by the no-code folks who control the money.
    In current times the market demands software built faster and progressively, the "no-code folks" want to ensure the feasibility of the project as soon as possible, so we changed to agile methodologies and the fullstack role emerged
    A developer capable of handling the 4 elements, front-end, back-end, database and whatever the client wants
    and he has to do it fast, so changing between technologies might not be a good idea - I would say that's pretty stressful in the long therm and can lead to burnout,
    to mitigate stress and bugs they use the same languages for back-end, front-end and DBmgnt
    like any business in a free market if they require an specific an team is required for a "blazing fast" backend they will have it but those are very specific cases, 90% of services would not have a significant workload nor care for a 200ms response, and if they do they'll probably scale horizontally or distribute copies across the world.
    that's the software reality:
    development time is more important than performance time

    • @nivethan_me
      @nivethan_me 2 роки тому +35

      Best argument for node i have seen in a while. I'll save this and going to use this forward 😂

    • @hypergraphic
      @hypergraphic 2 роки тому +20

      Yeah, I mean, how fast does Node have to be? 500 requests per second is not nothing. If Ruby on Rails is performant enough for a lot of use cases, I'm sure Node is too.

    • @pedrolarosa
      @pedrolarosa 2 роки тому +2

      Agree. Thanks for sharing!

    • @markhaus
      @markhaus 2 роки тому +12

      @@hypergraphic that’s what load balancers are for. Just increase the number of node nodes

    • @Justin-fq8dt
      @Justin-fq8dt 2 роки тому +10

      At the end of the day it really isn't a huge deal to use a different language for the backend and still use js/ts on the frontend. Most developers who have been programming for a couple of years probably know js and another language that can be use for backend services, and wouldn't have a problem switching between languages frequently while developing their own full stack project or while working as a full stack developer at a company. I think one of the notable advantages of node is for new devs who want to be able to work on both a frontend/backend of their own software while only knowing one language.

  • @lallenfrancisl
    @lallenfrancisl 2 роки тому +50

    Programming entertainment at its peak. Dude your videos are hilarious and super information packed at the same time

  • @ShubhamRao
    @ShubhamRao 2 роки тому +193

    While I'm waiting for Elixir, it would be interesting to also explore these numbers on a multicore machine! (Both performance and developer ergonomics)

    • @ThePrimeagen
      @ThePrimeagen  2 роки тому +112

      you people and elixir

    • @MarcosVMSoares
      @MarcosVMSoares 2 роки тому +36

      Elixir is life, elixir is Brazil ^^

    • @cherryramatis2508
      @cherryramatis2508 2 роки тому +12

      @@MarcosVMSoares elixir é nois

    • @Roupi
      @Roupi 2 роки тому +17

      @@MarcosVMSoares elixir é agro, elixir é pop, elixir é tech, tá na globo é elixir.

    • @nivaldolemos5280
      @nivaldolemos5280 2 роки тому +18

      @@MarcosVMSoares elixir is from brazil, lua is from brazil, come to brazil

  • @Voidstroyer
    @Voidstroyer 2 роки тому +112

    I'm looking forward to that Elixir video. I am really curious to see how it's performance stacks up against Go and Rust.
    Also, If I recall, in that video you did with Theo regarding unit testing, both of you agreed that you shouldn't touch Elixir and I am curious as to why. I understand that both of you are really picky regarding languages and their type systems, but I feel that Elixir has ways around its dynamic types that in many ways are either similar to typescript, some ways a bit worse, and in some ways a bit better (pattern matching on specific values and types). And Elixir has certain tools such as elixir_ls and dialyzer that help as well to make error detection during development easier.

    • @Sairysss1
      @Sairysss1 2 роки тому +13

      For people who are interested in Elixir, here is a comparison between Erlang and Go performance: www.dcs.gla.ac.uk/~trinder/papers/sac-18.pdf
      Elixir is based on Erlang's BEAM virtual machine so it should be pretty much the same.
      To summarize: Erlang/Elixir can spawn processes faster, but Go has better throughput than Erlang/Elixir and in general Go is more performant.
      But keep in mind that Erlang/Elixir is not all about performance, it's main strengths are fault tolerance and reliability. In that regard its much better than Go.

    • @qx-jd9mh
      @qx-jd9mh 2 роки тому +2

      @@Sairysss1 just call Rust through a NIF when you need to speed up Elixir

    • @LtdJorge
      @LtdJorge 2 роки тому

      @@qx-jd9mh it depends on the type of work. Many small function calls would probably be slow due to the overhead of calling to the NIF.

    • @qx-jd9mh
      @qx-jd9mh 2 роки тому

      @@LtdJorge did you actually look at benchmarks that compare the overhead of nifs?

  • @marctse3556
    @marctse3556 2 роки тому +18

    I came here with blazingly fast speed after the notification

  • @galileo_rs
    @galileo_rs 2 роки тому +5

    It is rare to find a video on UA-cam that you do not have to watch at 1.5x.

    • @ThePrimeagen
      @ThePrimeagen  2 роки тому +5

      I try to get to the point. I'm just so sick of videos that are just the most slow roll pieces of content ever.

  • @Eysvar
    @Eysvar 2 роки тому +48

    I don't know whether to be proud or ashamed that as soon as Prime showed the Go code, I immediately noticed it wasn't formatted with gofmt.

    • @ThePrimeagen
      @ThePrimeagen  2 роки тому +68

      it wasn't. I accept the fact that i hate the formatting and i am the only one using the repo, so suck it.

    • @avithedev
      @avithedev 2 роки тому

      @@ThePrimeagen finish him 😂

  • @buraky16
    @buraky16 2 роки тому +1

    This video's thumbnail (gopher licking bun with crazy eyes) is my current favorite developer meme. I can't help it, it's just so funny :D. Also wherever a tech community mentions "blazingly fast", that sound effect plays in my mind automatically lol

  • @Pbertrand_dev
    @Pbertrand_dev 2 роки тому +13

    Nice benchmark and amazing 11/10 mustache!
    Dare you to do a benchmark using PHP 8 and Swoole

  • @moitoius
    @moitoius 2 роки тому +8

    Lock-free is like async/futures/promises. It tends to scale well horizontally (more threads and cores), but does worse per-core - especially if there is a lot of contention on the resource. The new thing is wait-free data structures that are not only lock-free, but also avoid long compare-and-swap loops.

    • @ThePrimeagen
      @ThePrimeagen  2 роки тому +15

      wait free... I am getting too old for this shit

    • @cenowador
      @cenowador 2 роки тому

      This is interesting... But how does one achieve await free in node? Everything in there is a Promise

    • @moitoius
      @moitoius 2 роки тому

      @@cenowador this doesn't apply to node at all.

  • @andreagiorgi3512
    @andreagiorgi3512 2 роки тому +15

    It's really mind boggling how people could think a pure interpreted language can be fast like a compiled one. The difference between them, what assembly and machine language are, these are literally among the first things you learn at university during a basic computer engineering course... How in the hell could someone think a language, like Javascript, which uses strings in switch-case statements can be "fast"?

    • @steveoc64
      @steveoc64 2 роки тому +11

      Because even JS gets compiled to machine code at runtime.
      The slowness comes from dynamic types and gc

    • @LtdJorge
      @LtdJorge 2 роки тому +9

      If it hits the JIT, it’s machine code

    • @TheWallReports
      @TheWallReports 2 роки тому +4

      💯Exactly. I was thinking the very same thing. Node/JS is blazingly fast when compared with other [interpreted] languages of the same class like Python, PHP, Perl etc. Context matters. It's one of the fastest interpreted languages available. The only language I recall in the interpreted class that beats out Node/JS is Lua. But to pit it against a compiled or even byte-code compiled language like say Java is ludicrous. It says more about the people making such argument than the merits of test. It's like arguing a Crown Victoria can hold it own against a F1 race car.🤷🏾‍♂

    • @peezieforestem5078
      @peezieforestem5078 2 роки тому

      It's actually trivial to imagine, if, say, an interpreted language has multithreading and asynchronous features, where's compiled language doesn't.

  • @unowenwasholo
    @unowenwasholo Рік тому +1

    You had me at "Miku with a rocket launcher"

  • @jsimonlarochelle
    @jsimonlarochelle Рік тому +16

    Nice analysis. I'm not a fan of Go. The syntax is weird (I think they worked too hard not to look like Java). However, ..., GOs benchmark would have looked better on a multicore CPU which is what most PC are running except maybe on small embedded systems. If I am not mistaken, GO (like Java) uses a tracing GC and this will usually run on a separate thread and if this thread can actually map to an actual separate core then you get your memory management running in parallel. That is why languages and/or runtimes that use something like a tracing GC are normally very good for high throughput software on appropriate hardware. Whereas things like Python, Swift, ... which use a reference counting based memory manager, or Rust, Zig and others where you manually manage your memory will (in common implementation) actually trace the heap and manage memory on the same thread that is executing your code (except for a thread to manage circular references in Python, Swift, ...).
    On a single core, the tracing GC will still use an additional thread (at least one) but this will grab execution time from the single core and still involve context switching between the treads whereas Zig and Rust will not have this.
    So ... if you love GO's syntax and your not running your software on a hand held calculator chip, you will get good productivity and good performance.

  • @bendotcodes
    @bendotcodes 2 роки тому +50

    You forgot to mention that Go has an insane concurrency model with go routine. It makes building multi threading code 1000% easier. To me this is the big selling point. I would be curious to see the benchmark with more vCPU. Were you on only 1?

    • @anomaliespatiale6023
      @anomaliespatiale6023 2 роки тому +4

      I’m an absolute beginner with Go but was thinking the same thing. Maybe the experiment’s parameters are not a good fit for the concurrency model of Go?

    • @steveoc64
      @steveoc64 2 роки тому +19

      You will find that zig and rust do the same thing as go … async frames (coroutines) spread over cpu cores using a thread pool.

    • @bendotcodes
      @bendotcodes 2 роки тому +3

      @@steveoc64 Oh didn't knew about that, thanks for sharing! I know nothing about Rust maybe it's time to get my hand dirty 😅.

    • @steveoc64
      @steveoc64 2 роки тому +11

      @@bendotcodes rust does it via 3rd party packages - Tokio. Zig has it built into the stdlib, where it’s a bit easier to find and follow the code. It’s encouraged ( idiomatic even ) to roll your own custom event loop based on the stdlib example.
      I’ve been doing go professionally for just on 7 years now, but I never really understood the internals of how goroutines work, until learning zig. It’s awesome for that.

    • @SimonBuchanNz
      @SimonBuchanNz 2 роки тому +7

      @@steveoc64 it's weird to say "you need third party packages", when Rust put a lot of work into making the native async code work completely customizably. It's not "you need to", it's "you get to". Keep in mind, this same system works when you're building a kernel, or in a 1kB ram microcontroller.
      Although I wouldn't recommend it (for performance), it's not even that hard to implement an executor, it's logically just a queue of work to do and a way to go to sleep and wake up.

  • @TobiasSample
    @TobiasSample 2 роки тому +2

    0:33 I must comment my guess in advance. I guess Go, which is better than Rust because Go is a word that means moving, whereas Rust is a word that means why your bike doesn’t work because you left it in the rain you silly sausage

  • @thebrowhodoesntlift9613
    @thebrowhodoesntlift9613 Рік тому +1

    Bro really went:
    Zig 🏃💨
    Go 🏃💨
    Node 🤨

  • @bryanenglish7841
    @bryanenglish7841 2 роки тому

    I love watching these experiments. I keep meaning to make my own video about this but they taker forever to make. I admire your commitment.

  • @PsychoKiller250
    @PsychoKiller250 2 роки тому +6

    Another banger of a video prime, but a have a question, when the OG of backend languages Java will be tested against node to see which is the slowest language of them all?

  • @BeardedWrenchh
    @BeardedWrenchh 2 роки тому +1

    been waiting weeks for this video, LETS GO

    • @ThePrimeagen
      @ThePrimeagen  2 роки тому +1

      was it worth it?

    • @BeardedWrenchh
      @BeardedWrenchh 2 роки тому

      @@ThePrimeagen definitely worth the wait, i will note, i expected Go to do a little better than it did, It also would be cool to rerun these tests on a multi-core server and compare the differences

  • @LeszekZalewski
    @LeszekZalewski 2 роки тому +5

    Multicore machine is one thing, comparing the memory usage would be another - especially if you built it in a way to compare GC performance (or lack of it)

  • @soup-bud
    @soup-bud 2 роки тому +4

    What are your thoughts on the ergonomics of async Rust? Personally, for me it's bad enough to push me towards using Deno for most web-y things, but I would really like to go "all-in" on Rust.

    • @ThePrimeagen
      @ThePrimeagen  2 роки тому +2

      i really don't mind it. it takes a moment to get use to, but once you do, its pretty straight forward.

    • @hogstudio4819
      @hogstudio4819 2 роки тому

      If you don't mind Boxing, I'd say

  • @davidraymond8994
    @davidraymond8994 Рік тому +3

    I am a bit surprised at Rust versus Go I would have thought they would be a bit closer. I really like Rust but I am using Go for a new project because I couldn't really get up to speed quick enough with Rust.

  • @brilliantdirectoriestraining
    @brilliantdirectoriestraining 2 роки тому +1

    This is the video we wanted, and the video we needed.

  • @civetbutlemonbutmouse6087
    @civetbutlemonbutmouse6087 Рік тому +2

    going into this i predict zig

  • @TheBli7krieg
    @TheBli7krieg Рік тому

    dude! the intro, I was almost choking

  • @blazinglyfast1233
    @blazinglyfast1233 2 роки тому +1

    Great channel. Love your content

  • @kylegaijin
    @kylegaijin 2 роки тому +2

    Yes, Keep making cool videos. And... I guess that zig is going to be the fastest in this video.

  • @quachhengtony7651
    @quachhengtony7651 2 роки тому +27

    I would like to formally request a video on C# vs Go

    • @ThePrimeagen
      @ThePrimeagen  2 роки тому +29

      i will literally never do c# :)

    • @senpos
      @senpos 2 роки тому +3

      @@ThePrimeagen Why not? You don't like the .NET / Microsoft ecosystem? The language is too... "fancy" / Java-like? .NET Core seems to be blazingly fast!

    • @betajoudi1440
      @betajoudi1440 2 роки тому

      @@ThePrimeagen 😂😂

    • @quachhengtony7651
      @quachhengtony7651 2 роки тому +1

      @@ThePrimeagen Can you tell me why?

    • @200KGHantel
      @200KGHantel 2 роки тому +2

      @@quachhengtony7651 +1

  • @MohitDodhia
    @MohitDodhia 2 роки тому +4

    Hello, Prime! I love these videos. I was wondering if a Java vs Node vs Go vs Rust video is in the pipeline or not? Nonetheless, have a nice coconut-oily day!

  • @shubhamlatiyan7972
    @shubhamlatiyan7972 2 роки тому

    love this dude, amazing content

  • @grantwilliams630
    @grantwilliams630 2 роки тому +19

    I think elixir is a pretty good language for simple request handling. (It’s kinda garbage for actual computation though)

    • @ThePrimeagen
      @ThePrimeagen  2 роки тому +13

      i know nothing about elixir, we will see

    • @verified_tinker1818
      @verified_tinker1818 2 роки тому +6

      @@ThePrimeagen You'll love it! It's an incredibly fun language; a mix of Erlang, Ruby, Haskell, and I think even a bit of Prolog.

    • @harleyspeedthrust4013
      @harleyspeedthrust4013 2 роки тому +11

      @@verified_tinker1818 what a rollercoaster. I pooped when you said ruby and splooged when you said haskell

    • @luccahuguet
      @luccahuguet 2 роки тому +2

      @@ThePrimeagen do Julia too sometime!

    • @js-ny2ru
      @js-ny2ru 2 роки тому +1

      @@ThePrimeagen Check Elm also.

  • @moumous87
    @moumous87 2 роки тому +1

    Love these videos!

  • @prestonrasmussen1758
    @prestonrasmussen1758 2 роки тому +3

    I’m not familiar enough with the V8 JIT compiler to know exactly when it kicks in. I’m curious if you know whether or not the JS code would have been compiled to bytecode by the time you collected data? There will definitely be a significant performance difference between the interpreter executing the JS code while it’s warming up, and after the JIT compiler kicks in and bytecode is being executed instead.

    • @ThePrimeagen
      @ThePrimeagen  2 роки тому +5

      so for small functions it is ~1 - 3 runs, large functions (1000+ chars) it tends to be 7 - 15 (all depending on size).
      All code was jitted within the first couple requests.
      :)

    • @prestonrasmussen1758
      @prestonrasmussen1758 2 роки тому +1

      @@ThePrimeagen awesome, thanks for the info!

  • @caiofelix623
    @caiofelix623 2 роки тому +18

    hey prime, what do you think about make a video benchmarking go versus java (using quarkus or springboot as it framework)?

    • @ThePrimeagen
      @ThePrimeagen  2 роки тому +20

      i just wont do java. sowwy :(

    • @whorudra
      @whorudra 2 роки тому

      You hate java?

    • @__idan__
      @__idan__ 2 роки тому +1

      I can contribute a spring boot version

    • @DiegoVallejoDev
      @DiegoVallejoDev 2 роки тому +5

      @@ThePrimeagen admirable,
      a man of principles refusing to go into the java path

    • @DiegoVallejoDev
      @DiegoVallejoDev 2 роки тому +3

      @@ThePrimeagen but what about Kotlin?

  • @arcanernz
    @arcanernz 2 роки тому

    I’ve seen a lot of UA-camrs but ThePrimeagen is the most blazingly fast one.

  • @timhoeppner6691
    @timhoeppner6691 2 роки тому +1

    I'm really enjoying these benchmark style videos, keep up the good work!

  • @uchennaofoma4624
    @uchennaofoma4624 2 роки тому

    You videos always have a way of making me laugh. Thanks 😀

  • @LaPingvino
    @LaPingvino Рік тому

    Have you ever done some of these tests with TinyGo?

  • @ryanseipp6944
    @ryanseipp6944 2 роки тому +10

    Really want to see what happens when you go multi-core. I'd imagine rust/zig/go would pull away further but would highlight differences in how they handle concurrency across cores.

    • @ThePrimeagen
      @ThePrimeagen  2 роки тому +8

      correct, i would have to come up with a multicore strat with node first

    • @ryanseipp6944
      @ryanseipp6944 2 роки тому +5

      @@ThePrimeagen potentially multiple instances of the node server equal to number of cores and hit them on different ports

    • @BosonCollider
      @BosonCollider Рік тому

      If you need parallelism, Rust will likely win, simply because it is written specifically for the fast-multithread-code usecase.

  • @DiegoVallejoDev
    @DiegoVallejoDev 2 роки тому +1

    It's time for a collaboration with Dave Plumber

  • @hipnotickid12
    @hipnotickid12 2 роки тому +1

    I've seen the whole video but now I just mostly come back for 0:00 - 0:14. Cracks me up every time.

    • @ThePrimeagen
      @ThePrimeagen  2 роки тому +1

      It is the greatest intro that has ever happened

  • @chris-ew9wl
    @chris-ew9wl 2 роки тому

    Love the videos man, especially the last part about frontend stuff 🤣

  • @fabienpenso
    @fabienpenso 2 роки тому +22

    You should definitely add memory usage for each on top of speed performance. Memory has a higher cost than when we used bare metal servers, and it adds up quickly. Rust has massive pros for that compared to go and even more to node.

    • @steffen2592
      @steffen2592 Рік тому +1

      True. We have a Java server solution and CPU usage was never the problem, RAM is the issue.

  • @ChrisRuzin
    @ChrisRuzin 2 роки тому

    0:10 made me yell laugh. I had to explain to my wife what was so funny.

  • @casual_swag1116
    @casual_swag1116 2 роки тому +4

    Haskell or Elixir next ?

    • @ThePrimeagen
      @ThePrimeagen  2 роки тому +3

      elixir is on its way

    • @pryflack3646
      @pryflack3646 2 роки тому

      You should really talk about the BEAM though, rather than focusing on the language itself don’t you think ?
      I wouldn’t expect much better performance from Erlang for instance but that’s just a hunch.
      Getting Haskell perf would be very interesting due to its output being a binary but it’s a beast: hard to learn but beautiful language (opinion based on my limited experience though)
      Great channel, keep it up :)

  • @TheHellishFrog
    @TheHellishFrog Рік тому +2

    I did much simpler tests - like counting to one billion in a cycle - the (best) results: Node-Js = 11.5 sec, Bun = 12.0 sec, Go=5.7 sec, Java=5.2sec, Rust=110nano, Zig=52nano, Python - some ten minutes :). All code variants were written as simply and close to the basic example as possible, compiled, and optimized for speed. All tests were running on the same laptop i7 Ubuntu 22.

  • @MartinsTalbergs
    @MartinsTalbergs 2 роки тому +1

    "Blazingly" buzzword got me into FANG

  • @jackscheffel1509
    @jackscheffel1509 2 роки тому +3

    Prime -- have you checked out Nim? I would be interested to see how you feel about it and what you think about the DX.

  • @grantwilliams630
    @grantwilliams630 2 роки тому +10

    Zig actually has some pretty good container implementations in its stdlib

  • @n0kodoko143
    @n0kodoko143 2 роки тому +2

    Zig is gaining some traction

  • @MrR8686
    @MrR8686 Рік тому +1

    any more zig videos? it would be nice to see you try out more languages

  • @eventslooped
    @eventslooped 2 роки тому +1

    Can you throw in some classic for comparison? Like C# and Java?

  • @samucancld
    @samucancld 2 роки тому +2

    I live for hear you say blazingly fast, I don't care about the video, I don't even care about golang or node, I just want to hear you saying BLAZINGLY FAST

  • @adityasrivastava7504
    @adityasrivastava7504 2 роки тому +1

    Prime can you throw in java / c++ in this test bench. Please ?

  • @mpldr_
    @mpldr_ 2 роки тому

    I like the Gopher from the thumbnail who vomits an upside down Nike logo at a bun

  • @HyperCodec
    @HyperCodec Рік тому

    Can we all just appreciate that he called the project "zig-me-daddy"

  • @_thehunter_
    @_thehunter_ 2 роки тому

    comparison was fair enough

  • @heroe1486
    @heroe1486 2 роки тому

    When playing your character you sound like the Japanese voice of Tobi in Naruto, yes the one with the orange mask who disappears blazingly fast !

  • @Cookie-mv2hg
    @Cookie-mv2hg Рік тому

    I lost it in Node....`silence`...`blinggg effect`

  • @banzooiebooie
    @banzooiebooie 2 роки тому

    I can double the blazingly fast programming languages (videos) by watching in twice the speed. Booom! Go is now double the speed. Zig twice as blazingly fast. Node...

  • @jakobbouchard
    @jakobbouchard 2 роки тому +1

    The first time I learned about Zig was when I looked at ncdu's page. ncdu 2.0 uses it instead of C, which is interesting

    • @peezieforestem5078
      @peezieforestem5078 2 роки тому +2

      Zig is just a superior C, even if all you do is use it as a compiler. Just the build system alone is worth it.

  • @wlockuz4467
    @wlockuz4467 2 роки тому +8

    Would be interesting to see something similar with JS (node) vs Python.

    • @dandymcgee
      @dandymcgee 2 роки тому +6

      They're both so blazingly slow that the profile would never finish and there would be nothing to report.

  • @kevinzunigacuellar
    @kevinzunigacuellar 2 роки тому

    love your videos man!

  • @7h3mon
    @7h3mon Рік тому

    @ThePrimeagen is Elixir blazingly fast?

  • @hck1bloodday
    @hck1bloodday 2 роки тому

    That silence afer saying node got me, jajajajaja

  • @caseyclayton01
    @caseyclayton01 2 роки тому

    I've caught myself using blazingly fast at work, so thanks for that. Not in a serious context, we primarily use Rails and Elixir.

  • @Omikronik
    @Omikronik 2 роки тому +1

    I love your thumbnails

  • @hivemind9643
    @hivemind9643 2 роки тому +9

    I actually would love to see your take on Svelte. Looking forward

    • @AlexandreAbreu1
      @AlexandreAbreu1 2 роки тому

      This is a backend benchmark, Svelte is used in fronted. Doesn't make sense

  • @nathanie1637
    @nathanie1637 2 роки тому +1

    Have you ever tried worker threads with node?

    • @ThePrimeagen
      @ThePrimeagen  2 роки тому

      no, very curious with them.

    • @nathanie1637
      @nathanie1637 2 роки тому

      @@ThePrimeagen I read an article where Node was able to outperform Go with the use of worker threads.

  • @driden1987
    @driden1987 2 роки тому +1

    I laughed at node's intro, well played

  • @aGj2fiebP3ekso7wQpnd1Lhd
    @aGj2fiebP3ekso7wQpnd1Lhd Рік тому

    The details were not given about the TCP and TLS specifics and I'd guess those implementations are the bottlenecks, not the language. I run 650k concurrent TLS connections and double that without TLS in a tuned Go server on a single core VM in production. It took a lot of tuning to get there, but it was all networking.

  • @RobertoOrtis
    @RobertoOrtis 2 роки тому

    Svelte!!!! 🙏🏼🙏🏼🙏🏼

  • @MOON9FLY
    @MOON9FLY 2 роки тому +3

    I love you editing XD, Good video as usual

    • @ThePrimeagen
      @ThePrimeagen  2 роки тому +5

      Its the editor that does all the good moves. I am just the good looking model.

  • @elvor8512
    @elvor8512 2 роки тому +2

    I’m not sure I really understand the method of this experiment, could somebody explain in a bit more detail? How does an increasing size of the queue mean faster speed? (the method in the rust vs bun vs node video with requests/second made more sense to me, at least)

  • @cryptic1692
    @cryptic1692 2 роки тому

    I love the script kiddies roast

  • @ivanmartinezalberte6089
    @ivanmartinezalberte6089 2 роки тому

    You are speaking blazingly fast! I had to change video's speed to 0.25. Oh my Go!

  • @edwingarcia5043
    @edwingarcia5043 2 роки тому +27

    Prime, there's a Go package called `fasthttp`, and it says to be 10x faster (there's benchmarks) than Go built-in net/http.
    Maybe in the future, you could give it a try :)
    I think it would be very interesting to see if a different http implementation really speed things up.
    As the fasthttp docs says: It's an http server implementation for really performance servers.
    Thanks for your hard work and cool videos :D

    • @LiamStanley1
      @LiamStanley1 2 роки тому +22

      fasthttp shouldn't be used other than for very very veeeery specific scenarios -- it doesn't actually implement HTTP, it implements something "like HTTP", and thus you will find all sorts of fun compatibility problems with it in the real world, where you might not be able to control the clients hitting the server. Additionally, it's very unlikely that the http server portion of this was the bottleneck. 99% of the time it's the logic inside of the handlers, not the http stack itself. I.e. even if fasthttp is "10x faster than net/http", if net/http currently only impacts 1% of the performance, 10x means almost nothing. Not to mention that "10x" is only in specific scenarios, not regular scenarios, where performance is often only marginally better.

    • @edwingarcia5043
      @edwingarcia5043 2 роки тому +6

      @@LiamStanley1 I see, thanks for explaining

    • @wlockuz4467
      @wlockuz4467 2 роки тому +21

      "10x faster" than built-in net/http, Sir I think the term you're looking for is *BLAZINGLY FAST*

    • @potatoes_fall
      @potatoes_fall 2 роки тому

      The same goes for json, there are optimized modules

  • @vercolit
    @vercolit 2 роки тому +2

    Hey, it would be interesting to see how much performance you can etch out with C over rust and zig. Maybe even assembly, to see how much faster it can get over C? I know that I get better performance over even C++ when I use C, because I tend to write much simpler code that is way less abstract.

    • @peezieforestem5078
      @peezieforestem5078 2 роки тому

      That's not really language's fault, you can write everything you write in C in C++, in fact, I'd argue C-style C++ should be your default, only using advanced C++ features when really necessary.

    • @marcossidoruk8033
      @marcossidoruk8033 Рік тому

      Zig and C would probably be equally fast if written correctly, language is not the main concern, the optimizations made by the programmer are and both of these languages are extremely flexible and designed so that you can optimise your code as much as you want.
      Rust on the other hand makes it demonstrably harder to optimise, if you already fight the borrow checker writing naive implementations you are going to be fighting it 100x when optimising. Refactoring is also harder in (idiomatic) Rust because everything is sort of encapsulated into traits and some things in your code are executed implicitly and thus it is harder to reason and change te behaviour of the program. Also forget about RAII, that is something that will make everything 100x slower and if you do memory pools that you manage yourself then there goes the borrow checker.
      So yeah, idiomatic Rust would probably be a lot slower than optimised C and Zig, if you want real high performance Rust shouldn't be your first choice.

    • @marcossidoruk8033
      @marcossidoruk8033 Рік тому

      ​​@@eleanorbartle53541. If you write the assembly with care it will be faster, you just need to know what you are doing.
      2. clang isn't the best C compiler, that is gcc wich does not use LLVM and produces code that is equal or faster to clang in 90% of the cases, sometimes significantly so. Also Rust wound most likely be significantly slower.

  • @scottb4029
    @scottb4029 2 роки тому

    Prime , do you have any recommendations for videos or books for learning go?

  • @wildman-4ever
    @wildman-4ever 2 роки тому +1

    Can you please include dotnet core in your future videos comparison? Cheers

  • @elclippo4182
    @elclippo4182 2 роки тому +1

    Go, go, go!

  • @andredasilva6807
    @andredasilva6807 2 роки тому +1

    love the intro. node...

  • @wety789
    @wety789 2 роки тому

    The no compliments for node really got me 😂

  • @levi-ctorious3166
    @levi-ctorious3166 2 роки тому +1

    What are your thoughts about carbon?

  • @sinaebr7337
    @sinaebr7337 2 роки тому +3

    in last few years and after .NET 5, .NET community release lot's of benchmark that .NET was faster than go and close to Rust
    can you make a test like this for C# (.NET) ?
    also can be a representation of True OOP language with inheritance

  • @artist6000ish
    @artist6000ish 2 роки тому

    The reason I like this video is because of the title. I wouldn't have watched this video if it wasn't for the title. Instead of "Go is faster than Zig", if it were "Zig is faster than Go", I'd be like, "Well duh. Of course". But it said that opposite, which piqued my curiosity. And of course, half way through the video I realized, oh, he isn't showing that Go if faster than Zig. This was just a click-bait to make me watching something unnecessarily. Having already wasted 5 minutes of my life, I figure I double-down and waste another 5 minutes and write this post. Stockholm syndrome and all that.

  • @abuk95
    @abuk95 2 роки тому +3

    I wonder if Nim is blazingly fast as well, compared to Zig and Go!

  • @LuccDev
    @LuccDev 2 роки тому

    Do you have any good light themes recommendation for neovim ?
    Cool video too ;)

  • @madsxcva
    @madsxcva Рік тому

    I wish this also had a language that was actually used in the industry to see how these flavor of the month languages (except node) compare to them and if its worth actually learning them

    • @andrewrobie620
      @andrewrobie620 Рік тому

      Both Rust and Go are used extensively in the industry though? Sure they're not at Java/Python levels of adoption, but they're well past flavor of the month.

  • @RyanWhite04
    @RyanWhite04 2 роки тому +1

    JSONMessage vs JsonMessage vs JavaScriptObjectNotationMessage, which is better?

  • @fedevile
    @fedevile 2 роки тому +1

    I'd love to see the same tests in a multicore system, my guess is go would shorten the difference somewhat with rust/zig

  • @diegolikescode
    @diegolikescode 2 роки тому

    NODE. (Uncomfortable silence)

  • @andrewdunbar828
    @andrewdunbar828 2 роки тому +6

    Just what I would've expected. But I wonder how managed languages like Java and C# compare to Go. I'm guessing they'd be neck and neck but between Node and Go.

  • @pjf7044
    @pjf7044 Рік тому

    What actually makes a language faster than another ? I mean what is actually going on that allows it to make the most use of its environment (software or hardware?) to execute the instructions faster? Or is it actually due to the language executing instructions more efficiently due to a smarter/optimized process flow?

  • @dmitriyobidin6049
    @dmitriyobidin6049 Рік тому

    THe amazing part of go, is that you can take almost any backend dev and give him that server in go and he will be able to maintain it probably in the same day.
    You can't say the same about rust, and even zig. It's kinda easier than rust, but has a much more complexity than go.
    It seems like best way to iterate is to just start your product with Go and move quickly, and when you see that go is just not gonna cut it anymore - rewrite in rust. And you know what? Thanks to go complexity it will be much easier to reason about.

  • @kebien6020
    @kebien6020 2 роки тому +1

    Wait, are you telling me that node is about half the speed of straight up Rust? That's way faster than it has any right to be.
    Like, I know that JS is JIT compiled and all that stuff. But just doing obj.someProp has to recursively check if someProp exists on the object, or in the object's prototype, or in the prototype's prototype and so on until it reaches a null value. JS runtimes have to be doing crazy stuff to make it so that those things are efficient.

    • @ThePrimeagen
      @ThePrimeagen  2 роки тому +1

      its a simple test so somethings are not present in its implementation. More complex projects can be significantly slower.

  • @act0r399
    @act0r399 2 роки тому +1

    I don’t see yet video, but I think that Zig is blazingly fast😃