← Back to context

Comment by ycombinatrix

4 months ago

>I realized that what I'd boiled it down to looked an awful lot like Rust code

you're no longer writing idiomatic java at this point - probably with zero object oriented programming. so might as well write it in Rust from the get-go.

If I'd started in Rust I likely wouldn't have finished it at all. Java allowed me to start out just focused on the algorithm with very little regard for memory usage patterns and then refactor towards zero garbage collection. Rust can sort of allow the same thing by just sprinkling everything with clone and/or Rc/Arc, but it's much more in the way than just having a garage collector there automatically.

Yes but it would just be the hot loop in this case; the rest of the app can still be in idiomatic Java, and you still get the GC.

  • Exactly. Write it in Java, optimize what you need to, leave the rest alone.

    • As polyglot dev, I never understood this religious approach that it has to be 100% pure unadulterated in language XYZ for performance.

      Nope, embrace the productivity of managed languages, if really needed, package that rest in a native library, done.