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 #1

Updated by Tanishehe about 9 years ago

A wild new contributor appears

I'm on it @delroth!

Actions #2

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

Actions #3

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.

Actions

Also available in: Atom PDF