Hacker News new | ask | show | jobs
by brabel 90 days ago
Yeah, Java is pretty fast despite the fact that it still has these kinds of obviously suboptimal things going on.

I love how Zig, D and Rust do exactly what you say: parse the format string at compile time, making it super efficient at runtime (no parsing, no regex, just the optimal code to get the string you need).

I say this but I write most of my code in Java/Kotlin :D . I just wish I could write more low-level languages for super efficient code, but for what I do, Java is more than enough.

3 comments

Kotlin string interpolation turns into the fancy invokedynamic based string concatenation behind the scenes so it's very optimized: https://openjdk.org/jeps/280
I admire Rich Hickey's approach of building on top of the Java ecosystem for this reason, adding a functional first approach with emphasis on data structures, where using the right algorithms comes naturally.
> Zig, D and Rust

Also C++, which works the same way.