-
Notifications
You must be signed in to change notification settings - Fork 172
flat_map : 速度比較として検索がmapより遅いと書かれていたのを修正 #1533
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
base: master
Are you sure you want to change the base?
Conversation
faithandbrave
commented
Oct 3, 2025
- std::flat_mapの検索速度がstd::mapに劣る? #1531
⚡ プレビュー (HTML) (更新時刻: 2025-10-06 17:58:23 JST) 変更記事一覧4件の記事が変更されました。
※ソース (.md) に直接変更のあった記事を列挙しています。グローバル修飾や変換規則の変更による変化は考慮していません。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
自分の認識と一致しました。問題ないと思います。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[`std::unordered_map`](/reference/unordered_map/unordered_map.md)よりは劣る
計算量は劣るけれど、実際の時間で std::unordered_map
より遅いかはかなり微妙な問題の気がします…繰り返し触る場合 std::flat_map
の方が局所性に優れているのでサイズによっては std::unordered_map
よりも速いかも (実測していないですが 追記: さまざまな処理系でさまざまなサイズで実測するのは面倒です。あとハッシュ関数の時間にも依ります)。
その観点は同感です。ほとんどの文脈で計算量の話をしていて、一部で計算量が同じの場合だけ実際の時間の話をしている、ということを明確にした方が良いのかもしれませんね。 |
こんな記事があったなぁとは思い出しましたが、参考リンクに載せるほどでもないしなぁという > 実測 |
「ハッシュ表は無料ではない」という言葉があるように、小さいサイズなら
こういう感じでどうでしょう? |
それだと "大きいサイズの
|
これらの参考リンクは載せたら便利の気がします。 |
yumetodoさんの記事は、Boost.Containerの |
こちらで修正しました。 |
なるほどです… |