Posts

Showing posts from February, 2017

Umbraco Dictionary Key Performance

I've re cently had the task of optimizing a clients website. On my tour of the site i noticed an instance where 20-30 dictionary keys are requested in succession for a single view. I decided to do some performance testing and find out how quickly the action is performed before and after caching. I made 25 keys in the backoffice with naming following this scheme "key0", "key1" and so on. controller action: public   string  Get() {      StringBuilder  sb  =   new   StringBuilder ();      var  timer  =   new   Stopwatch ();     timer . Start();      for  ( var  x  =   0 ; x  <   25 ; x ++ )         Umbraco . GetDictionaryValue( "key"   +  x);     timer . Stop();      return  timer . ElapsedMilliseconds  +   "ms "   +              timer . ElapsedTicks  +   " ticks" ; } Results were on first run (presumably includes a database query) 112ms 262011 ticks  then progressively lower  32ms 74887 ticks