News for hackers. Stuff that matters.
Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by chrisseaton on Tuesday December 24, 2019 @04:52PM (#21875146)
> Reflection actually isn’t too inefficient

My understanding is that it's completely uncached. It couldn't be any less efficient.

Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by twic on Wednesday December 25, 2019 @03:23PM (#21880251)
Obtaining a Method object is, I think, pretty slow. But calling through one is fast - I'm not sure what happens exactly, but after some number of calls, some sort of JITting or some such happens and a call via a Method object is as fast as as through a handwritten equivalent (which does the same unpacking of arguments etc).
Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by kasperni on Tuesday December 24, 2019 @07:19PM (#21875851)
The overhead of, for example, invoking a method via reflection is measured in single-digit nanoseconds. Still not as fast as direct invocation, but unlikely to be a bottleneck unless you perform 10-of-millions of them per second.
Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by LgWoodenBadger on Tuesday December 24, 2019 @08:00PM (#21876010)
Actually finding the method via reflection is the time consumer.

Once you have the method reference, actually invoking it isn’t any different than a regular method.

Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by sk5t on Tuesday December 24, 2019 @11:54PM (#21876898)
Although I can't tell you why, it's been my experience that firing a simple method via reflection in both .NET and the JVM is roughly 2x the time of direct calls (or of calls via the 'dynamic' keyword in C#).