Re[6]: Как и где хранить данные справочников? Нужен совет...
От: Oyster Украина https://github.com/devoyster
Дата: 07.06.05 11:08
Оценка: 12 (1)
Здравствуйте, _FRED_, Вы писали:

[... skipped ...]

TK>>поэтому, используется дополнительная косвенность при обращении к static

TK>>переменной.

_FR>На сколько это дорого?


http://blogs.msdn.com/ricom/archive/2005/02.aspx

The runtime supports a lightweight process-like environment called an AppDomain. Each AppDomain has its own copy of all static variables. Because of this, any domain nuetral code must use 5-10 instructions to access static fields of just 1. The JIT can optimize many cases (allowing one fetch of AppDomain variables to serve many static field fetches in the same method), but there are cases when no optimization can be done. Domain Nuetral code is more common in Whidbey. Static field access overhead is actually worse than write barriers in the worst case: the static field access goes from one cycle to roughly ten cycles. However because the overhead of field fetches can be combined (and pulled out of loops) the impact of slower field fetch is generally less than that of write barriers. It has no measurable impact at all in many scenarios (for instance the framework code tends to not use static much).

 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.