5 ms·
I bet you are allocating/deallocating something in a loop. Give the Go profiler a whirl. I bet it will be pretty easy to remove, too. I have not run into a cas
by simpleguitar 6y ago
I bet you are allocating/deallocating something in a loop. Give the Go profiler a whirl. I bet it will be pretty easy to remove, too.
I have not run into a case where go can't be within 2x speed of C.
And I love how zig is even closer to C, but has the ergonomics of go.
What an amazing time to be alive.
- axaxs 6y agoThat's what I was thinking. When I was learning Go years ago, I decided to go through and speed up some of the Benchmark Game's Go code. Some were on the order of 20x speedup if I remember right. Of course, the maintainer of the site rejected it because of what I perceive as a clear bias against the language, but the point is...it's easy to fix hotspots in Go.
- drran 6y agoMy contributions to Benchmark Game for Rust are accepted. ;-)
- gher-shyu3i 6y agoCan you link to the bitbucket pull requests?
- axaxs 6y agoWhich repo? If it has a full history, perhaps I could find it? I have a link, but it's dead now... http://benchmarksgame.alioth.debian.org/u32/program.php?test=binarytrees&lang=go&id=6 http://benchmarksgame.alioth.debian.org/u32/program.php?test... This was in 2013. My first submission was using memory pools for binary trees. It was rejected for using memory pools, even though the C version quite literally used mempool. I even redid it to use a 'third party' mempool library, rejected for the same reason. I didn't even bother submitting any others.
- igouy 6y agohttps://salsa.debian.org/benchmarksgame-team/archive-alioth-benchmarksgame/-/tree/master/contributed-source-code/benchmarksgame/binarytrees https://salsa.debian.org/benchmarksgame-team/archive-alioth-... https://blog.golang.org/ismmkeynote https://blog.golang.org/ismmkeynote
- axaxs 6y agoThanks for the links, though I'm unsure what the second link is for. I hope my assessment is 'fair.' I used to feel more strongly than I do now, I guess. It's a weird situation. The rules say 'dont write your own memory pools', but new languages wouldn't have a popular library available. Seems it should be 'dont use them at all', or allow them for all. This puts any new language at an immediate disadvantage. Anyhow, thanks for keeping it going so long. Fun little site.
- igouy 6y agoIn this case, the new language Go had GC available.
- axaxs 6y agoC has malloc and free available, even when it was new.
- igouy 6y agoNon sequitur? "Go was born out of frustration with existing languages … To meet these goals required addressing a number of linguistic issues: an expressive but lightweight type system; concurrency and garbage collection …" https://golang.org/doc/faq#creating_a_new_language https://golang.org/doc/faq#creating_a_new_language https://golang.org/doc/faq#garbage_collection https://golang.org/doc/faq#garbage_collection Seems like you wished not to show one of Go's big features?
- 6y ago
- drran 6y agoYep, Go program does allocating/deallocating in the loop, while the equivalent Rust program does not. Moreover, Rust program compiled with O3, LTO, and PGO. Go version: 75 us, Rust: 15 us.