Porting Java's ConcurrentHashMap to Rust (part 2)

preview_player
Показать описание
In this stream we continue the work of porting Java's ConcurrentHashMap to Rust. We finish up the concurrent hash table resizing code, and then dive into the safety-critical code around collecting garbage. At this point, the code with support for get, put, and resize compiles, though it has not been tested yet.

There's a short break at 01:51:04 which ends around 01:56:16. The unsafe garbage collection code starts after the break.

Рекомендации по теме
Комментарии
Автор

I think the best thing from coding live streams is that no one gets it right the first time and always has to debug. Always comforting, especially when learning new languages.

longtiem
Автор

Ty so much for these livestreams. I'm learning a lot.

macacofumasa
Автор

3:34:20 ... Picks random spot to start listening...
"Nope...
That's not great..."
"That's really awkward!"
lol. Must have slept thru that.

DHorse
Автор

As for 1:43:43 – I think `sc = n - (n >> 2)` is equivalent to sc = n - n/4 = ³/₄n and `size_ctl` is actually the threshold load factor at which you want to resize the table (75%). Again very weird hand-microoptimized way to do that math.

benedyktjaworski
Автор

Thanks for this live stream, I'm waiting for the part 3.

diegorocha
Автор

@48:58 when you removed the loop won't you end up with different code? Remember that assignment in the first if sets eh.. second if will effectively check it relative to zero. And you get two paths thru.

jeremyflowers
Автор

"... and then we will dive head first into garbage"
Yeah, exactly what my maths teacher told us in the beginning of the school year xD He was wrong tho, wasn't as awful as last year (not because maths is pain or whatever, but because the book made lots of mistakes by itself (exercises which you just can't solve like taking a sqrt of a negative number and so on) xD

xenon
Автор

Circa @3:33:32 - @3:33:59 you took null check at start of loop off.. will p never be null at the start? Refactoring looked wrong.

jeremyflowers
Автор

@4:21:20 - safety comment.. 'p' -> node?

jeremyflowers
Автор

@2:42:14 comment: are since -> are fine since

jeremyflowers
Автор

@41:06... Hate the Java for(;;) {} loop in the Java implementation... Why not while (true) {} ... So much more intuitive! ;-)

jeremyflowers
visit shbcf.ru