Possible Duplicate:
How costly is .NET reflection?
The ‘elegant’ solution to a problem I am having is to use attributes to associate a class and its properties with another’s. The problem is, to convert it to the other, I’d have to use reflection. I am considering it for a server-side app that will be hosted on the cloud.
I’ve heard many rumblings of ‘reflection is slow, don’t use it,’ how slow is slow? Is it so CPU intensive that it’ll multiply my CPU time so much that I’ll literally be paying for my decision to use reflection at the bottom of my architecture on the cloud?
Just in case you don’t see the update on the original question: when you are reflecting to find all the types that support a certain attribute, you have a perfect opportunity to use caching. That means you don’t have to use reflection more than once at runtime.
To answer the general question, reflection is slower than raw compiled method calls, but it’s much, much faster than accessing a database or the file system, and practically all web servers do those things all the time.