G
Guest
After developing basic plug-in system I have put it to performance test.
The general concept is two app domains one, the primary hosts main
application, secondary runs plug-ins (dynamic assemblies pre-compiled or
compile-on the first use)
Here are some basic numbers for those that care about performance:
Assembly loaded into primary app domain, dynamic object instantiation,
interface based access.
Execution time 0.586019172827831 seconds
Executions per second 1706428.81046794
The same exact code, except assembly is loaded into second app domain,
interface based access as well.
Execution time 32.1589118170047 seconds
Executions per second 31095.5795298779
Optimizations didn’t really help (for an obvious reason)
The point of the story is - dynamic code compilation is nice, but if you
cant execute within the same domain or greatly reduce a number of cross
domain calls - don’t expect high performance.
When I moved execution process into secondary domain and reduced number of
cross domain function calls from 1000000 to 4, performance was back on track
and summarized to:
Within Primary App domain
Execution time 4.17137876461953 second
Executions per second 2397288.8975744
Within Secondary App Domain
Execution time 4.27427592054297 second
Executions per second 2339577.55322676
The general concept is two app domains one, the primary hosts main
application, secondary runs plug-ins (dynamic assemblies pre-compiled or
compile-on the first use)
Here are some basic numbers for those that care about performance:
Assembly loaded into primary app domain, dynamic object instantiation,
interface based access.
Execution time 0.586019172827831 seconds
Executions per second 1706428.81046794
The same exact code, except assembly is loaded into second app domain,
interface based access as well.
Execution time 32.1589118170047 seconds
Executions per second 31095.5795298779
Optimizations didn’t really help (for an obvious reason)
The point of the story is - dynamic code compilation is nice, but if you
cant execute within the same domain or greatly reduce a number of cross
domain calls - don’t expect high performance.
When I moved execution process into secondary domain and reduced number of
cross domain function calls from 1000000 to 4, performance was back on track
and summarized to:
Within Primary App domain
Execution time 4.17137876461953 second
Executions per second 2397288.8975744
Within Secondary App Domain
Execution time 4.27427592054297 second
Executions per second 2339577.55322676