Hacker News story: How can a mutex in Wine be faster than a native one on Linux

How can a mutex in Wine be faster than a native one on Linux
System information * CPU: 11th Gen Intel Core i7-1165G7 * System: Linux Mint 22.2 * Kernel: 6.11.0-1014-lowlatency (no ntsync) * Sys libc: GNU C library 2.39 * Wine: 9.0 * Compiler: GCC 13 (both) Configurations and time of execution (lower is better) * linux std: ( 8.150 s) std::mutex, backed by pthread * linux boost: (10.936 s) boost::mutex * win std: (20.246 s) std::mutex, backed by CRITICAL_SECTION * win boost: ( 4.849 s) boost::mutex * win srw: (15.853 s) SRWLOCK * win mcf0i: ( 4.117 s) _MCF_mutex from mcfgthread, inlining disabled The test uses code from https://ift.tt/StMjx30 Hyperfine screenshot: https://ift.tt/Vxv7Czw When boost::mutex is compiled natively it's slower than glibc, but when it's compiled for Windows and run in Wine it outperforms everything except mcfgthread, including native glibc mutex. Does this mean the glibc mutex is inferior in design, or is it sorta magic in thread scheduling in Wine that makes boost::mutex behave better in this test? 0 comments on Hacker News.
System information * CPU: 11th Gen Intel Core i7-1165G7 * System: Linux Mint 22.2 * Kernel: 6.11.0-1014-lowlatency (no ntsync) * Sys libc: GNU C library 2.39 * Wine: 9.0 * Compiler: GCC 13 (both) Configurations and time of execution (lower is better) * linux std: ( 8.150 s) std::mutex, backed by pthread * linux boost: (10.936 s) boost::mutex * win std: (20.246 s) std::mutex, backed by CRITICAL_SECTION * win boost: ( 4.849 s) boost::mutex * win srw: (15.853 s) SRWLOCK * win mcf0i: ( 4.117 s) _MCF_mutex from mcfgthread, inlining disabled The test uses code from https://ift.tt/StMjx30 Hyperfine screenshot: https://ift.tt/Vxv7Czw When boost::mutex is compiled natively it's slower than glibc, but when it's compiled for Windows and run in Wine it outperforms everything except mcfgthread, including native glibc mutex. Does this mean the glibc mutex is inferior in design, or is it sorta magic in thread scheduling in Wine that makes boost::mutex behave better in this test?

Hacker News story: How can a mutex in Wine be faster than a native one on Linux Hacker News story: How can a mutex in Wine be faster than a native one on Linux Reviewed by Tha Kur on August 26, 2025 Rating: 5

No comments:

Powered by Blogger.