≈ the.bay.news

Yet Another Performance Footgun in Rust - Multithreading Lock Edition

Rust Internals
Yet Another Performance Footgun in Rust - Multithreading Lock Edition
It turns out that RAII can lead to performance "footguns", not just regarding memory, but also with multithreading locks. The "holding a mutex longer than necessary" footgun. It’s easy to fall into this trap : { let data = data.lock() data.update(10) // ...lots of other code... } Oops, the mutex remains locked for the entire duration of the scope, even though it only needed to be held until the final write to the data variable. This degrades performance because other threads are...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.