Emulator Issues #8240
closedMake Core::IsCPUThread() faster by using thread local storage
0%
Description
https://github.com/dolphin-emu/dolphin/pull/1987 caused a large performance regression by causing IsCPUThread() to be called in a hot path when this function was not designed to be fast.
The regression was adressed quickly in https://github.com/dolphin-emu/dolphin/pull/2067 by removing the problematic assertion in release builds, but this is not an ideal fix since it makes bugs harder to detect. Instead, IsCPUThread() should really be made faster.
I've posted an idea on how to make this faster in the comments of PR 2067: using thread-local storage to identify the CPU thread. This should make IsCPUThread() the equivalent of one memory load, aka. extremely fast compared to the current version.
Easy one for potential new contributors :)
Updated by Tanishehe about 9 years ago
A wild new contributor appears
I'm on it @delroth!
Updated by Tanishehe about 9 years ago
I haven't worked with Threads much and I also have never contributed to an Open Source project so this was really fun. It wasn't to difficult and I plan on coming back for more.
The pull can be found here https://github.com/dolphin-emu/dolphin/pull/2076
Updated by JosJuice about 9 years ago
- Status changed from New to Fixed
That PR has been merged now, so I guess this issue is fixed.