3 ms·
Well, on the benchmarckgame (internet reference for microbenchmarks), you're mostly right, go is faster than Java but slower than c#. But real-world applicatio
by The_rationalist 7y ago
Well, on the benchmarckgame (internet reference for microbenchmarks), you're mostly right, go is faster than Java but slower than c#.
But real-world applications performance needs fine tuned libraries that scales and this is where Java destroy both go and c#.
- apta 7y agoTake the benchmarkgames site with a big grain of salt. They're running on an old processor, and that biases results a lot. For example, someone submitted a patch that significantly sped up a Java benchmark by using `Math.fma()`. However, because the processor the benchmarks site is running on is old and does not support the underlying instruction that `Math.fma()` uses, it ended up way slower. I ran several benchmarks locally on a CPU that's a few years old where the benchmarks site shows golang being faster than Java, without changing the code, and I got the opposite result (Java was faster). Especially the longer the program ran. For example, the site shows that golang is faster in the spectral norm benchmark. Running it locally with a larger input parameter: golang: time ./test 30000 1.274224153 18.81 real 70.19 user 0.38 sys Java: time java spectralnorm1 30000 1.274224153 16.18 real 105.95 user 0.45 sys Or with the nbody benchmark: golang: time ./nbody 60000000 -0.169075164 -0.169012474 6.09 real 6.04 user 0.02 sys Java: time java nbody 60000000 -0.169075164 -0.169012474 6.04 real 5.94 user 0.06 sys
- Thaxll 7y agoFastHTTP destroys Netty, isn't Netty a fined tuned library?
- e12e 7y agoI'm not sure - I don't use either go or Java much these days - but some cursory googling implies that light-4j/undertow core is to fasthttp as netty is to net/http? https://github.com/networknt/light-4j/ https://github.com/networknt/light-4j/
- apta 7y agoFastHTTP is a low allocation HTTP library in golang. Netty is a low level event driven framework for writing networking applications and protocols. It's used in many libraries and frameworks which build on top of it like Vertx, Spring webflux, and more recently Undertow. Things should get more interesting once Java gets green threads, which would make it easier to implement high performance concurrent servers without needing to drop down to event driven code unless for specific needs. That, and with value types, should push the performance bar forward.
- apta 7y agoApples to oranges comparison. Netty is a general purpose event driven networking library. FastHTTP is specialized to HTTP. Even given that, Vertx (which uses Netty) ranks above FastHTTP in the Techempower benchmarks, even though they have to be taken with a grain of salt.
- lightgreen 7y agoNetty is not tuned. It handles large stream of small messages very inefficiently: too many synchronization per message, no automatic batching to avoid expensive write syscalls. At least it was so two years ago.