Project

General

Profile

Actions

Emulator Issues #8240

closed

Make Core::IsCPUThread() faster by using thread local storage

Added by delroth about 9 years ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
% Done:

0%

Operating system:
N/A
Issue type:
Task
Milestone:
Regression:
No
Relates to usability:
No
Relates to performance:
Yes
Easy:
Yes
Relates to maintainability:
No
Regression start:
Fixed in:

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 :)

Actions

Also available in: Atom PDF