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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Designing a new concurrent data structure

108 点作者 goodroot超过 1 年前

8 条评论

IndoorPatio超过 1 年前
In my experience Left-Write is the clear place to start. It&#x27;s general purpose and fast for reads. Only if that is unsuitable (eg memory usage) does one design a custom data structure. There&#x27;s a Rust lib implementation with links to more resources:<p><a href="https:&#x2F;&#x2F;docs.rs&#x2F;left-right&#x2F;latest&#x2F;left_right&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;docs.rs&#x2F;left-right&#x2F;latest&#x2F;left_right&#x2F;</a>
评论 #37300583 未加载
评论 #37303060 未加载
评论 #37302724 未加载
评论 #37303508 未加载
评论 #37300685 未加载
jerrinot超过 1 年前
Hello, the author here. It feels great to see my blog on HN!<p>It was quite a journey, at first I thought I invented a novel concurrency schema. However, it turns out that it was simply a mix of my ignorance and hubris! :-)<p>Still, I had a lot of fun while designing this data structure and I believe it made a nice story. Ask me anything!
评论 #37302310 未加载
评论 #37301777 未加载
singron超过 1 年前
You could also check out hazard pointers. This is basically the example used in <a href="https:&#x2F;&#x2F;melodiessim.netlify.app&#x2F;intro-hazard-ptrs&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;melodiessim.netlify.app&#x2F;intro-hazard-ptrs&#x2F;</a>
motoboi超过 1 年前
Hi. You missed the opportunity to implement the reader as an AutoCloseable and do the get as a Reader method.<p>That way, classe users will be warned by the IDE that they should use a try-with-resources when acquiring a Reader.<p>For the sake of completeness here, Java compiler will warn about it, but that warning is disabled by default.
评论 #37300419 未加载
nitwit005超过 1 年前
Did you consider just making an array of HashMap, say 512 of them, and locking only one of them based on your key&#x27;s hash?<p>Or, more generally, minimizing the odds of waiting on a lock, without resorting to a complex lock free scheme?
评论 #37303460 未加载
cafxx超过 1 年前
Why not just allocating the blobs off-heap? (That is something you probably want to do anyway if it&#x27;s cryptographic material, to avoid being at the mercy of the GC leaving copies around)<p>ByteBuffer.allocateDirect should do that IIRC. This allows you to use the standard ConcurrentHashMap while being able to get a stable pointer for use by the rust logic.
评论 #37301397 未加载
评论 #37303401 未加载
audnaun252超过 1 年前
seems like a lot of effort - could you have moved the map state to rust instead? to invoke the AuthCrypto.verifySignature with just the key?
评论 #37300364 未加载
bionhoward超过 1 年前
cool article, I learned a lot, but I’m scratching my head wondering why they’re settling for Java on this project when Rust is better suited for it, seems like with the lifetimes, need for consistency and concurrency, memory leak issues, and generally the goal for high performance, this would be an awesome project for learning Rust