3 ms·
If you write a simple for loop incrementing `i` then yeah Java runs almost as fast as C. In whole programs where GC unpredictably runs and does all sorts of nas
by gnulinux 8y ago
If you write a simple for loop incrementing `i` then yeah Java runs almost as fast as C. In whole programs where GC unpredictably runs and does all sorts of nasty things like dirtying pages and pressuring the cache, you won't get anything close to C. Citation needed.
- spricket 8y agoThis was true until a few years ago. Java 11 has a new ultra-low-pause GC that's almost entirely multi-threaded and mostly predictable. There's plenty of semi-realistic benchmarks out there. I like TechEmpower the best since they test an entire web framework + database. Several java implementations are right up there with C, along with .NET Core, Go, and Rust. In the vast majority of cases the extra 20-50% speed of C isn't worth the dangers.