3 ms·
Usually you might want to instead use code generation at compile time to do these things, even in Java. Reflection is always magnitudes slower.
by kuschku 10y ago
Usually you might want to instead use code generation at compile time to do these things, even in Java.
Reflection is always magnitudes slower.
- caseymarquis 10y ago.NET allows you to use reflection to emit bytecode which does the same work as reflection. More complicated to setup, but the speed-up is huge. Not sure if Java has an equivalent? I'd be curious to know.
- barrkel 10y agoYes. You generate bytecode for classes that are loaded by a class loader, and thereby enter the JIT world etc. The tech predates .NET, but it isn't as developer friendly as DynamicMethod etc.