Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arm64 python: Avoid nested class in insn hook for 10x hook and 10% overall speedup #2095

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

droe
Copy link

@droe droe commented Jan 25, 2025

Promote CpReg to a module-level class to address unnecessary performance reduction.

In a real-world use case tracing the emulation of real-world machine code, this change reduces time spent in CpReg namedtuple construction from 10% of overall time to below 1%, a ~ 10x speedup of the insn hook itself, or a ~ 10% overall speedup. Measured using cProfile, python 3.13.

Promote CpReg to a module-level class to address unnecessary performance
reduction.  In a real-world use case tracing the emulation of real-world
machine code, this change reduces time spent in CpReg namedtuple
construction from 10% of overall time to below 1%, for a 10x speedup of
the insn hook itself, or a 10% overall speedup.  Measured using
cProfile, python 3.13.
@droe
Copy link
Author

droe commented Jan 25, 2025

Build failures look unrelated to this change.

@wtdcode
Copy link
Member

wtdcode commented Jan 26, 2025

No idea why it suddenly fails. Let me rerun it firstly.

@droe
Copy link
Author

droe commented Feb 1, 2025

Failures still look unrelated to this PR. Similar failures also happen in other PR branches. Also, it looks like GCC is crashing, and I'd be very surprised if this Python-only change would cause a GCC crash.

@wtdcode
Copy link
Member

wtdcode commented Feb 2, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants