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

speed up setting attributes #638

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

maartenbreddels
Copy link
Contributor

Setting an attribute on a trait is slow, because we always trigger callbacks, even when they are not there. This speeds it up by 3x.

Before:

------------------------------------------------- benchmark: 1 tests ------------------------------------------------
Name (time in us)           Min      Max    Mean  StdDev  Median     IQR   Outliers  OPS (Kops/s)  Rounds  Iterations
---------------------------------------------------------------------------------------------------------------------
test_performance_set     5.5110  94.8380  6.9445  2.8176  6.0430  0.2957  3040;3721      143.9978   21575           1
---------------------------------------------------------------------------------------------------------------------

After:

------------------------------------------------- benchmark: 1 tests ------------------------------------------------
Name (time in us)           Min      Max    Mean  StdDev  Median     IQR   Outliers  OPS (Kops/s)  Rounds  Iterations
---------------------------------------------------------------------------------------------------------------------
test_performance_set     1.8560  89.3450  2.2384  1.3132  2.0570  0.0880  2200;2725      446.7546   37368           1
---------------------------------------------------------------------------------------------------------------------

@rmorshea
Copy link
Contributor

rmorshea commented Nov 17, 2020

It looks like you have to go to a lot of effort to look up the "magic" notifier methods.

Probably fine to support them in this PR, but maybe we should think about officially deprecate those? We've had the deprecation message 1+ years, so no one should be surprised if we finally dropped support. Thoughts @minrk?

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