TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Parallel Hashmap

3 点作者 cr4zy大约 3 年前

2 条评论

cr4zy大约 3 年前
With getpy[0], a python wrapper, you can get 200x faster map reads in parallel<p><pre><code> In [1]: import numpy as np ...: import getpy as gp In [2]: key_type = np.dtype(&#x27;u8&#x27;) ...: value_type = np.dtype(&#x27;u8&#x27;) In [3]: keys = np.random.randint(1, 1000, size=10**2, dtype=key_type) ...: values = np.random.randint(1, 1000, size=10**2, dtype=value_type) ...: ...: gp_dict = gp.Dict(key_type, value_type, default_value=42) ...: gp_dict[keys] = values ...: ...: random_keys = np.random.randint(1, 1000, size=500, dtype=key_type) In [4]: %timeit random_values = gp_dict[random_keys] 2.19 µs ± 11.6 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops each) In [7]: %timeit [gp_dict[k] for k in random_keys] 491 µs ± 3.51 µs per loop (mean ± std. dev. of 7 runs, 1,000 loops each) </code></pre> [0] <a href="https:&#x2F;&#x2F;github.com&#x2F;atom-moyer&#x2F;getpy" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;atom-moyer&#x2F;getpy</a>
rurban大约 3 年前
Still the state of the art, bypassing folly and the swisstables on parallel benchmarks.<p>And even on single threaded workloads it&#x27;s about 10x faster than std::unordered_map. My smhasher has benchmark tables.