Skip to content
0:00 / 0:00

#concurrenthashmap#flurry#garbagecollection

Porting Java's ConcurrentHashMap to Rust (part 1)

Jon Gjengset

111K subscribers • 38 videos on Hallway

YouTube
  • Recommended by 1 person: 1 in engineering communities.
  • Presented by Jon Gjengset
  • Linked in the descriptionjonhoo/flurry

Advanced. Deep dive for people who know the field.

82K views6 years ago1 recommendation

Programming languagesSystems programmingRustJava and the JVMConcurrency and parallelism

Jon Gjengset live-codes the process of porting Java's ConcurrentHashMap to Rust, dealing with concurrency and memory management differences.

In this stream we begin the work of porting Java's ConcurrentHashMap to Rust. It will be a journey to get all the way there, but we got through most of the get, insert, and resize operations. Of particular note is the work required to go from the Java code's reliance on the garbage collector to Rust's runtime-free model. See also the commit for the stream at github.com/jonhoo/flurry/commit/50fc36cb4056e68ea96fbf8f2148…. You can see our progress at github.com/jonhoo/flurry. The Java code we were working from is included in that repository, or you can view it at hg.openjdk.java.net/jdk/jdk13/file/0368f3a073a9/src/java.bas…. You can watch the live version with comments at youtu.be/hUi6HyVOAKM Introduction Reading Java's ConcurrentHashMap documentation Copying documentation and constants Starting node Writing BinEntry::find Creating the library outline Writing get Writing put and insert Transfer and resize Porting Java triple bit-shift More resizizing Questions and conclusion

Why it's here

1 person recommends this

What people say. Recommended as an in-depth look at Rust's ownership model and concurrency compared to Java's garbage collection.

u/peppermilldetectivein r/rust • Recommends

On “Resources about how rust is better than OOP with code examples?”

Personally, rather than saying "Rust is better than X language for N reasons", it's better to instead look at "Why is composition better than inheritance?", "Why is not having null a good thing?", "What is ownership?", and "What are lifetimes?" instead. I say this because your question seems to be less "Why is Rust better?" and more "Why is the *mindset* behind Rust better?". While there are things inherently wrong with OOP, the ideas behind what make Rust good are actually applicable to any language, it's just that Rust enforces them at compile time. In terms of Rust v. Java, I could only find: - This post to r/rust - This blog post comparing a few different languages based on HTTP perfo…