Skip to content

Scope: minimize the number of gets#41

Merged
danielbeardsley merged 6 commits into
masterfrom
scope--minimize-storing
Jan 28, 2026
Merged

Scope: minimize the number of gets#41
danielbeardsley merged 6 commits into
masterfrom
scope--minimize-storing

Conversation

@danielbeardsley

Copy link
Copy Markdown
Member

If getting the scope prefix value is a miss, then we all keys under the scope are by definition a miss, so we don't need to bother looking.

This defers the generating and storing of the scope prefix value till we actually need it (on a set). In practice, this will reduce the number of gets if using getMultiple() or if you don't always set() on a miss.

If getting the scope prefix value is a miss, then we all keys under the
scope are by definition a miss, so we don't need to bother looking.

This defers the generating and storing of the scope prefix value till
we actually need it (on a set). In practice, this will reduce the number
of gets if using getMultiple() or if you don't always *set()* on a miss.

This comment was marked as outdated.

masonmcelvain
masonmcelvain previously approved these changes Dec 23, 2025

@masonmcelvain masonmcelvain left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CR 👏🏻 but dev_block 👍🏻 on what might be a bug

Comment thread tests/ScopeTest.php
Comment thread library/iFixit/Matryoshka/Scope.php Outdated
Comment thread library/iFixit/Matryoshka/Scope.php Outdated
The Short circuit should prevent getMultiple from being called and we
weren't explicitly check for that.
We weren't using the $scopeValue we just created when doing the set().

Also, refactor it for clarity.

Add a test to ensure we're setting the value.
masonmcelvain
masonmcelvain previously approved these changes Dec 24, 2025

@masonmcelvain masonmcelvain left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CR 👏🏻 Looks much better, thanks!

Comment thread library/iFixit/Matryoshka/Scope.php
@kwiens

kwiens commented Jan 20, 2026

Copy link
Copy Markdown
Member

un_dev_block 👍 Looks like this is ready to test again.

@kwiens

kwiens commented Jan 27, 2026

Copy link
Copy Markdown
Member

@danielbeardsley Does this need testing, or is it ready to merge?

@danielbeardsley

Copy link
Copy Markdown
Member Author

It passes tests. So, I guess QA 👍

@masonmcelvain masonmcelvain left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CR 👏🏻

@danielbeardsley danielbeardsley merged commit ba70ec0 into master Jan 28, 2026
2 checks passed
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.

4 participants