Problem std::mapより高速なコンテナはありませんか? Solution std::mapは十分速いコンテナですが、より速いハッシュコンテナが存在します。 代表的なハッシュコンテナ(の実装)としては次のようなものがあります。 ・次期C++標準unordered_map ・SGI系hash_map ・GoogleCode sparse_hash_map ・GoogleCode dense_hash_map これらのハッシュコンテナについて、std::mapと処理速度の比較を行ってみました。 評価には次のコードを使用しました。 今回は、std::stringをキーとして100万個の要素を追加し、200万個の検索を行いますので、検索の半分は存在しないキーでの検索になります。 コンパイラはgcc version 4.1.2で、最適化オプシ
Suppose that you're working with some data that has values associated with strings -- for instance, you might have student usernames and you want to assign them grades. How would you go about storing this in C++? One option would be to write your own hash table. This will require writing a hash function and handling collisions, and lots of testing to make sure you got it right. On the other hand,
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く