r/cpp • • Jan 11 '26

CppCon Making C++ Safe, Healthy, and Efficient - CppCon 2025

https://youtu.be/p52mNWsh-qs?si=Bz6pyW6d0SMLCZxV

Now with some updated content since the ACCU talk, and the Q&A is nonetheless interesting.

55 Upvotes

103 comments sorted by

View all comments

Show parent comment

7

u/QuaternionsRoll Jan 12 '26

Unless I’m misunderstanding you,

enforcing exclusivity at runtime

you can use any algorithm you want, and it doesn't require modifying existing code

you can’t have it both ways. Many algorithms and data structures rely on non-exclusivity. Doubly-linked lists are famously difficult to implement in safe Rust, and impossible to implement without incurring a substantial runtime overhead à la RwLock (you can’t even use RefCell if you want to replicate the fact that LinkedList implements Sync).

3

u/servermeta_net Jan 12 '26

There are plenty of efficient double linked lists in rust. Even idiomatic ones (no unsafe) that are more efficient than idomatic CPP ones. I personally really like arena allocated DLLs.

1

u/QuaternionsRoll Jan 12 '26

arena allocated DLLs

look inside

Vec<Option<(T, usize, usize)>>

Unless you’re saying “just use an arena allocator library”, to which I say “just use LinkedList”.

1

u/servermeta_net Jan 13 '26

No that's not how I would do it, you can move more optimizations to compile time. But what's wrong in your opinion? You still think that performance would be problematic?

In any case if you are using x64 you can achieve a very similar result by tagging pointers in single threaded apps, and using capabilities in multithreaded apps.