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

Replace JDLIB::hash_set_thread with std::unordered_set #43

Merged
merged 1 commit into from Mar 2, 2019

Conversation

ma8ma
Copy link
Collaborator

@ma8ma ma8ma commented Mar 2, 2019

従来のstd::vectorstd::setを使うJDLIB::hash_set_threadの替わりにstd::unordered_setを使います。また、使われなくなったhash_set_threadのヘッダーと実装ファイルを削除します。

前提条件

  • hash_set_threadはURL文字列を格納し検索に使われる
  • 扱うURLは100件を超えることがある

比較

従来の方法よりstd::unordered_setを使うほうが挿入時の計算が簡明になり検索速度も速いです。

  • 従来: hash -> modulo -> indexing(std::vector) -> insert(std::set)
  • 新しい: hash -> insert(std::unordered_set)

事前に要素数が分かる箇所ではstd::unordered_set::reserve()で要素数を設定して挿入中のメモリ再配置を回避するようにします。

従来のstd::vectorとstd::setを使うhash_set_threadの替わりに
std::unordered_setを使う。

前提条件
hash_set_threadはURL文字列を格納し検索に使われる
扱うURLは100件を超えることがある

比較
従来の方法よりstd::unordered_setを使うほうが挿入時の計算が簡明になり
検索速度も速い。
従来: hash -> modulo -> indexing(std::vector) -> insert(std::set)
新しい: hash -> insert(std::unordered_set)

事前に要素数が分かる箇所ではstd::unordered_set::reserve()で
要素数を設定すれば挿入中のメモリ再配置を回避できる。
@ma8ma ma8ma added the performance 性能の改善 label Mar 2, 2019
@ma8ma ma8ma added this to In progress in State of JDim-v0.1.0+ via automation Mar 2, 2019
@yama-natuki yama-natuki merged commit 954886c into JDimproved:master Mar 2, 2019
State of JDim-v0.1.0+ automation moved this from In progress to Done Mar 2, 2019
@yama-natuki
Copy link
Collaborator

おーいいですね
ありがとうございます

@ma8ma ma8ma deleted the std-unordered_set branch March 2, 2019 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance 性能の改善
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants