3 ms·
Will Kotlin and Scala benefit?
by esafak 2y ago
Will Kotlin and Scala benefit?
- daxfohl 2y agoThey should. It's a JVM feature on core JDK classes.
- taeric 2y agoThis implies they have their own String implementations? I wouldn't be shocked to find out that is the case, but it would surprise me.
- daxfohl 2y agoWhy? IIUC it implies that they _don't_ have their own string implementations. They get the benefit of Java JDK's string implementation (and JVM optimization thereof) for free. If they had their own string implementations, they'd be unable to use this optimization until it's publicly available.
- taeric 2y agoHa! My apologies, I misread that as "they shouldn't." Not sure why.
- xxs 2y agoJava strings enjoy heavy optimizations, including SSE4.2 and AVX intrinsics. Implementing your own byte[] wrappers (which Strings are) might be useful however it won't replace the built-in Strings. In short: a general purpose String substitute in Java would be an extremely poor idea.
- jillesvangurp 2y agoIf you use Kotlin/Scala on the JVM, yes. You can also use Kotlin on native (ios, win32, linux, etc), wasm, or on top of javascript. Scala has at least a js compiler and maybe some other ones as well. You won't see any improvements on these other platforms.