this post was submitted on 16 Jul 2023
1280 points (98.9% liked)

Programmer Humor

32426 readers
1007 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[โ€“] odbol@lemmy.world 4 points 1 year ago (1 children)

That's wild that shared ptr is so inefficient. I thought everyone was moving towards those because they were universally better. No one mentions the performance hit.

[โ€“] Duralf@lemmy.world 5 points 1 year ago

Atomic instructions are quite slow and if they run a lot... Rust has two types of reference counted pointer for that reason. One that has atomic reference counting for multithreaded code and one non-atomic for single threaded. Reference counting is usually overkill in the first place and can be a sign that your code doesn't have proper ownership.