nhibernate-core
nhibernate-core copied to clipboard
Use compiled expression in AliasToBeanResultTransformer
Possible breaking change: As now expression is compiled on first transformation - this transformer can't be reused for different queries. Transfomer can still be reused but only for the same query.
Perf comparison for 5 aliases and 50 000 transformations on my machine (see #2015 with side by side comparison): 300 ms vs 15 ms for Compiled version
We can cache the compiled delegate by aliases to avoid breaking changes.
Yeah. But is it worth it? Current transformer design means that lookup is required on each record transformation. I don't think that this reusing is commonly used (as our docs say nothing about it) and from my tests didn't saves much. If you are in to such optimizations - you better cache transformer per query for yourself.