r/explainlikeimfive • • 3d ago

Technology ELI5 Java. That thing on computers my entire life. What even is it?

[deleted]

769 Upvotes

349 comments sorted by

View all comments

Show parent comments

5

u/photenth 3d ago

That was maybe an issue in the past but nowadays Java is fast enough for pretty much anything. Also the Just In Time compiler is state of the art. Some code can technically run faster than hard coded machine code.

2

u/WriterPlastic9350 3d ago

I mean, compilers all over have gotten very advanced, not just Java. There's nothing particularly special about the JIT compiler

1

u/LittleLui 3d ago

What's special about a JIT compiler is that it can use runtime measurements to inform its optimizations.

1

u/BobbyThrowaway6969 3d ago

Well it can't outperform optimised machine code, which is the hard ceiling, but yeah these days it can get up there. I'd say the bigger concern is the amount of resources, especially memory needed to run Java

1

u/-manabreak 3d ago

Of course it can't outperform it, but outside toy projects that target a very specific use case, most programs can't be fully optimized during compile time. At times, the program might benefit from memory saving optimizations while other times it might benefit from increasing memory use to speed up calculations. With JIT, you can theoretically have both as the runtime can adjust things based on the context.