Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use std::unordered_set instead of std::vector for res information #61

Merged

Commits on Mar 21, 2019

  1. Use std::unordered_set instead of std::vector for res information

    定数MAX_RESNUMBERによって定められているレス数の上限を取り除くため
    std::vector<char>で管理しているしおりなどのレス情報を
    レス番号(int)をキーにしたstd::unordered_set<int>で管理する。
    
    修正の根拠
    しおり、書き込み、返信などのマークはレス数に対して十分少なくなるはず。
    したがってstd::vectorを使ってレス数と同じサイズの領域を確保する必要性は
    低いと考えられるのでハッシュセットにレス番号を記録する方法へ変更する。
    
    パフォーマンスの影響
    挿入時にハッシュ計算(レス番号=int)のコストがかかる。また、最悪の場合
    ハッシュの再計算や挿入時にメモリの再確保が発生する。
    レス情報が増加するほどstd::vectorと比べてメモリ使用量が多くなる。
    レス番号の順序が必要な箇所があるが実行される条件は限られている
    (プロパティのあぼ〜ん設定)のでstd::set<int>の一時変数を使っている。
    ma8ma committed Mar 21, 2019
    Configuration menu
    Copy the full SHA
    c24df85 View commit details
    Browse the repository at this point in the history
  2. Rename variables and functions

    ma8ma committed Mar 21, 2019
    Configuration menu
    Copy the full SHA
    d49ad9e View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    47f523f View commit details
    Browse the repository at this point in the history