PRE SIP: ThisFunction | scope injection (similar to kotlin receiver function)

Actually, if you really care about avoiding allocations at all cost (which include excess software maintenance costs) then you should avoid the whole Java platform. Project Panama and Project Valhalla are not ready yet, so extracting maximum possible performance is hard under Java. Because of that e.g. network drivers written in Java are much slower than ones written in Rust, C# or Go: https://github.com/ixy-languages/ixy-languages (IIRC they or someone else came to a wrong conclusion that Java is generally bad for network related purposes, because they missed the fact that Java platform contains a lot of C/C++ code for performance critical tasks).

Otherwise, if you care about final performance of your application and not performance of a small part of it, then you should profile the performance and measure what’s the impact of a specific portion of your app on the whole app.

1 Like