3 ms·
> The additional refcount takes space that could be used for the payload that now either needs to spill into the next cacheline or needs to be compressed furthe
by volta83 5y ago
> The additional refcount takes space that could be used for the payload that now either needs to spill into the next cacheline or needs to be compressed further.
It could, but since the cachelines are adjacents the prefetcher will pull subsequent cache lines anyways, and since the objects typically used in doubly-linked lists are very large (much larger than 64-bit), then this doesn't matter on any practical application that I am aware of. Our results of 4% performance increase is for the worst-case that we found. Usually is 1% or less.
If you have a real-world benchmark that shows otherwise, can you please share it?
AFAIK there does not exist any hardware for which the performance model for:
- non-intrusive doubly-linked lists,
- typical object sizes used on these lists (>> 64-bit)
- typical operations done on these lists (splice, etc.)
would predict a performance difference, and in our case, having replaced unsafe lists with safe list in many large applications, we never were able to measure a difference in application performance, only in the synthetic worst-case micro-benchmarks.
So I am truly interested to learn about your use case.
- quotemstr 5y agoYou're ignoring the case of a list being densely packed and embedded inside another data structure. If you bloat a data structure with a useless machine word, there are all sorts of ways for that machine word to hurt the resulting program, and you can't just handwave that away. The Linux kernel is made by people who spend weeks to shave one bit off the size of a data structure. Do you really think they'd respond positively to your saying they don't need to do that? You really need to stop assuming what kind of computers other people are programming The larger point here is you don't get to decide whether other people's use cases are legitimate. Either Rust gives you complete control of the machine or it does not. It does not, not in safe mode, but Rust people keep doing this annoying motte and bailey thing about it.
- volta83 5y ago> You're ignoring the case of a list being densely packed and embedded inside another data structure. No, I am not. This conversation is exclusively about non-intrusive doubly-linked lists. If you want to have a conversation about intrusive doubly-linked lists we can have it, but it is a very different data-structure. > You really need to stop assuming what kind of computers other people are programming Every week I touch x86, arm, ppc64, riscv and gpu assembly. I write code for apps daily that run from 16-bit micro controllers to the largest super computers in the world, going through phones, desktops, cloud, etc. I am not assuming what others are programming, but rather talking about what I program for, which include most hardware that anyone can buy today, and quite a bit of hardware that almost no one can even buy, as well as hardware that's not for sale.
- arcticbull 5y agoThis conversation started where folks were talking about where to begin learning Rust. Beginning by learning unsafe{} implementations of a doubly-linked list to save 1-4% of the performance isn't where I would recommend anyone begin learning. If they do need to shave a single bit off, they can do that, that's a neat feature too.