ResourceManager 続き

とりあえず、

public class ResMgr
{
  private readonly ResourceManager rm;
  private readonly Hashtable       cache;

  public ResMgr(Type t)
  {
    this.rm    = new ResourceManager(t);
    this.cache = new Hashtable();
  }

  public string GetString(string key)
  {
    if (!this.cache.Contains(key))
    {
      this.cache[key] = this.rm.GetString(key);
    }

    return this.cache[key] as string;
  }
}

みたいなクラスを作って Hashtable からひくようにしたら、さらに遅くなった(笑)
まあ Hashtable と string.GetHashCode() や string.Equals() ぐらいで入れ替わるような速度ではないと思っていたが…。
そういえば、整数なんかがキーになっている Hashtable は、標準の HashcodeProvider/KeyComparer を利用するよりも、ちょっとした比較コードを追加したほうが、ちょっと高速に動作する場合が多い、というのは結構意外だった。