Reflection Version info vs Global Cache performance

  • Thread starter Thread starter gabe
  • Start date Start date
G

gabe

We use a custom versioning scheme that includes the date and time
(2.0.10271545). The version number is displayed in a footer user
control, which is rendered in every page. The web application is in a
web farm. Would there be a significant performance increase by adding
it to the global cache object, instead of reading the version info
every time through reflection for the version that's set in the
AssemblyInfo file?(Instead of just the first time)

Since it's on a web farm, I would check that if it didn't exist to read
it.

Thanks,

Gabe
 
It will improve performance, but by how much I do not know.

Anyway, as a matter of practice, it is usually better to cache information
that is used a lot but changes little. In the case of the version, the
version will *never* change simply because if you drop a new assembly
version, the site will reset itself causing all variables to disappear.
 
As test I ran two 10,000 loop iteration tests trying each way. Reading
the version info using reflection every time was 600 milisecs. Figuring
the version using reflection for only the initial read and storing it
in the cache (using refection to get the exectuing assebmly createdate)
yeilded 40 milisecs, so it was 15 times faster using the cache.

Thanks for the design tip ---
 
Back
Top