314
you are viewing a single comment's thread
view the rest of the comments
[-] PlexSheep@infosec.pub 1 points 1 year ago

You mean mutex? Arc allows synchronous read only access by multiple threads, so it's not a performance bottleneck. Locking a mutex would be one.

[-] tatterdemalion@programming.dev 5 points 1 year ago

Arc is not free, and the extra atomic operations + heap allocations can become a bottleneck.

[-] PlexSheep@infosec.pub 1 points 1 year ago

Oh, I did not know that. Well, it makes sense that it has a heap allocation, as it becomes more or less global. Though not sure why the atomic operations are needed when the value inside is immutable.

[-] Miaou@jlai.lu 1 points 1 year ago

How can you otherwise keep track of an object's lifetime if copies are made concurrently?

[-] mholiv@lemmy.world 3 points 1 year ago* (last edited 1 year ago)

I mean it could be Mutex, or Rwlock or anything atomic. It’s just when I have to put stuff into an Arc<> to pass around I know trouble is coming.

this post was submitted on 05 Jul 2025
314 points (98.5% liked)

Programmer Humor

33017 readers
499 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 3 years ago
MODERATORS