NightOwl888 commented on issue #630: URL: https://github.com/apache/lucenenet/issues/630#issuecomment-1085883859
LukeMapper uses [Reflection.Emit](https://docs.microsoft.com/en-us/dotnet/framework/reflection-and-codedom/emitting-dynamic-methods-and-assemblies) to generate on-demand MSIL code at runtime, which it compiles and caches after the first hit. This is a very good approach that will have a small impact on runtime performance. However, the object mapping could potentially be made into a compile-time [source generator](https://docs.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/source-generators-overview), which would eliminate the need for the initial runtime compile and cache. In other words, there would be absolutely no runtime performance impact because it would generate the cumbersome-to-maintain code based on the easy-to-maintain configuration, which would be compiled into the end user's assembly. There is an extensive [list of source generators](https://github.com/amis92/csharp-source-generators#readme) being maintained where various approaches to source generation can be analyzed. LukeMapper's entry point is on `IndexSearcher`. `IndexSearcher` [may be used with `SearcherManager` to make it threadsafe](https://github.com/apache/lucenenet/issues/616#issuecomment-1054364945), which should be taken into account in the design. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
