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

options refactor: OptionKey initialisation is too slow #14245

Open
bruchar1 opened this issue Feb 12, 2025 · 1 comment · May be fixed by #14250
Open

options refactor: OptionKey initialisation is too slow #14245

bruchar1 opened this issue Feb 12, 2025 · 1 comment · May be fixed by #14250
Labels
options Meson configuration options perf

Comments

@bruchar1
Copy link
Member

The generate_target function of ninja backend takes 55s for me on master, but 84s on the optionrefactors branch.

It seems it spends a lot of time constructing OptionKey objects. I think the @total_ordering decorator is one cause of that. Removing it allowed to reduce time to 64s in my profile.

Also, the __eq__ operator should use the _hash member instead of comparing tuples.

@bruchar1 bruchar1 added the options Meson configuration options label Feb 12, 2025
@bruchar1 bruchar1 added this to the optionrefactor milestone Feb 12, 2025
@bonzini
Copy link
Collaborator

bonzini commented Feb 13, 2025

Related to #14248, #14250.

bruchar1 added a commit to bruchar1/meson that referenced this issue Feb 14, 2025
OptionKey objects are used extensively. We want them with a simple API,
but they also need to be optimized to not compromise meson performances.

Since this is an immutable object, it is possible to cache the
OptionKey object creation. We need to do it using the __new__
to make the caching mechanism transparent.

Fixes mesonbuild#14245
@bruchar1 bruchar1 linked a pull request Feb 14, 2025 that will close this issue
@bonzini bonzini added the perf label Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
options Meson configuration options perf
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants