开发者

Enum with attributes and performance

I plan to use enum with attributes instead of lookup tables. I开发者_如何学编程 worry about performance. Should I query attributes once and create static dictionary for example? Are there out of box solutions?


You should worry about performance when you have a slow application, not before.

Make sure you application works and works correctly, before you start optimizing it.

The right way to deal with performance is to measure and find bottle necks using a performance monitor, then fixing the worst cases.

You question and approach describes micro-premature-optimization at its worst.


This question is difficult to answer because you haven't provided any details about the expected frequency of calls. You might expect a performance penalty from using Reflection to query attributes but is this penalty going to be bottleneck to your application? The only way to know is to perform load tests. I am afraid that at this stage you are doing what is called premature optimization.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜