News for hackers. Stuff that matters.
Re:Java Reflection, 1000x Faster by rhpistole on Wednesday September 13, 2017 @08:59PM (#15244140)
That's the kind of solution I've used before when performing reflection in a tight loop. The important thing there is to cache the result of the compiled expression or the dynamic IL code because the compile time/emit is slower than a single use of reflection.
Re:Java Reflection, 1000x Faster by flukus on Thursday September 14, 2017 @12:41AM (#15245064)
> The important thing there is to cache the result of the compiled expression or the dynamic IL code because the compile time/emit is slower than a single use of reflection

I came across some code a few weeks ago that skipped this step. It wasn't called remotely often enough to justify the complication in the first place (low volume internal web app) but it didn't cache the result so it ended up making things slower. Thanks to the wonders of RenderAction in MVC it compiled the dynamic IL 20 times per page view as well.