Go lang vs C language speed test 😱 shocking result #shorts #golang #c #coding

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

C flushes output every time, remove print and see which is fast

Miles-coxm
Автор

bruh you can't just write bad c and blame it on the language

devsteel
Автор

I think we can all agree that while C is still an undisputed champion of low-level programming and pretty much irreplaceable for embedded systems (yes, Rust bros, I hear you, and Rust CAN be used in C's place, can you still do it without `unsafe {}` all over the place? not to say Rust is bad, but you're still opening yourself up to vulnerabilities), Go is a great language with few "moving parts", its compile times are amazing, the compiler in general is great (the only one I loved more was GHC, but I'm heavily biased in favor of GHC and Haskell in general, while not knowing it well at all, and have very limited experience with both Haskell and coding in general), and Go programs are sufficiently fast while Go is garbage collected, and as a GCd language Go is absolutely unparalleled. Like out of all things Google has ever made, Go's gotta be THE best one, Google's crown jewel in my books. Also, I have to remind everyone that Go was created with the author of C's input to say the least, so I trust the lessons from C were included in creation of Go.
Let the holy war commence.

nekoill
Автор

Concurrency implemented in golang inherently, while C is support posix pthread and you should do it manually.
Rewrite same program but add pthread and see rockets launched around u

mohammedmarhnine
Автор

For all blaming the bad c Code what's about the bad Go code... Printf is the slowest Methode for this output

dominic_dl
Автор

This isn't benchmarking loop speed. You should remove the print statement from the loops and then run the programs.

WaseemAshraf
Автор

What are you measuring?
Output? Printing, calculation?

digital_train
Автор

i'll go back to c if there is new standard like slice in go lang, , , slice is powerful, maybe same in vector in c++ must be in standard in c language to make it more beautiful language

musiclife
Автор

There's a potential performance issue with calling printf within the loop for such a high number of iterations, which can slow down the program significantly. If the purpose is to measure the loop's execution time without I/O interference, it would be better to remove the printf from within the loop.

traveldiary
Автор

Haha... Man, you have an error in your C code. Correct result:
For C: Time taken: 23.437500 ms
For Go: Time taken: 42.935253 ms

In your C code replace:
time_taken = ((double)(end_time - start_time) / CLOCKS_PER_SEC) * 1000.0;

ironudjin
Автор

I think you're just measuring the printf() function speed since it will outweigh everything else you're doing.

spaceowl
Автор

complete bollocks, you are just testing the speed of the output system. What drivel.

michaelhex
Автор

There's a logical error in your code for time count

frxk
Автор

Print is an unfair function to iterate on, try some thing more fair

hamidalramzy
Автор

Congrats! u test printf speed. Not the lang speed.

Chapeu_de_aluminio