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

Update to current fastest env setitem #4556

Merged
merged 4 commits into from
Jun 28, 2024

Conversation

mwichmann
Copy link
Collaborator

Updated and re-ran benchmark tests for SubstitutionEnvironment.__setitem__. Added test for new (Python 3.0) string.isidentifier() method. That's actually exactly what we want, and it times out as the fastest method when combined with a membership test if the variable is already defined.

Tweaked some comments about this performance consideration, and did other updates in bench/.

No doc impacts as there are no behavioral changes.

Contributor Checklist:

  • I have created a new test or updated the unit tests to cover the new/changed functionality.
  • I have updated CHANGES.txt (and read the README.rst)
  • I have updated the appropriate documentation

Updated and re-ran benchmark tests for SubstitutionEnvironment.__setitem__.
Added test for new (Python 3.0) string.isidentifier() method.
That's actually exactly what we want, and it times out as the fastest
method when combined with a membership test if the variable is
already defined.

Tweaked some comments about this performance consideration,
and did other updates in bench/.

Signed-off-by: Mats Wichmann <[email protected]>
mwichmann and others added 2 commits June 15, 2024 13:26
Didn't notice that the changes for env.__setitem__ caused a quote
mark to flip in the error output, failing one test (a back-quote
went to a single regular quote). Updated the test, and snuck in
the tools-performance-hack.

Signed-off-by: Mats Wichmann <[email protected]>
@@ -51,7 +53,7 @@ def cache_type_e_is_Dict(e):

def cache_type_e_is_List(e):
t = type(e)
return t is list or isinstance(e, UserList)
return t is list or isinstance(e, UserList or isinstance(e, deque))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this right? or inside the isinstance()?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that got clumsy. I'll fix - think should be single isinstance

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, it was supposed to look like the one a few lines later. pushed update.

@bdbaddog bdbaddog merged commit dc42f22 into SCons:master Jun 28, 2024
5 of 8 checks passed
@mwichmann mwichmann added this to the 4.8 milestone Jun 29, 2024
@mwichmann mwichmann deleted the perf/env-setitem branch June 29, 2024 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants