|
|
|
|
|
by Animats
140 days ago
|
|
I struggled with this in Wine. "malloc" type memory allocation involves at least two levels of spinlocks. When you do a "realloc", the spinlocks are held during the copying operation. If you use Vec .push in Rust, you do a lot of reallocs.
In a heavily multithreaded program, this can knock performance down by more than two orders of magnitude. It's hard to reproduce this with a simple program; it takes a lot of concurrency to hit futex congesion. Real Windows, and Linux, don't have this problem. Only Wine's "malloc" in a DLL, which does. Bug reports resulted in finger-pointing and denial.[1] "Unconfirmed", despite showing debugger output. [1] https://bugs.winehq.org/show_bug.cgi?id=54979 |
|