nhibernate-core icon indicating copy to clipboard operation
nhibernate-core copied to clipboard

Use compiled expression in AliasToBeanResultTransformer

Open bahusoid opened this issue 6 years ago • 2 comments

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

bahusoid avatar Feb 25 '19 10:02 bahusoid

We can cache the compiled delegate by aliases to avoid breaking changes.

hazzik avatar Feb 26 '19 09:02 hazzik

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.

bahusoid avatar Feb 26 '19 10:02 bahusoid