Repository navigation
SADD, SREM, SMOVE and TYPE ask about one member, not the whole set - #3173
Open
matrixarkai wants to merge 2 commits into
Open
matrixarkai wants to merge 2 commits into
matrixarkai wants to merge 2 commits into
Conversation
…he whole set Each listed every member of the set (SetMembers) to search it or to ask whether it was empty, so the cost followed the size of the set for an answer about one member. They now issue SetIsMember per argument, and SetCard for TYPE. A member named twice in one SADD still counts once because each add lands before the next lookup. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… any size Two default-build tests (answers, and the commands the door issues) and an allocation probe with the whole-set listing as the clone control, all pinned by exact name in rust-ci.yml. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
SADD,SREM,SMOVEandTYPEat the RESP door each listed every member of the set (SetMembers) to search it or to ask whether it was empty. They now askSetIsMemberper argument (SetCardforTYPE), the two read commands added in #3148. One shared helper (set_has_member) servesSADD,SREMandSMOVE. A member named twice in oneSADDstill counts once, because each add lands before the next lookup. No stored byte, log record or answer changes.Allocations per door call (counting allocator, debug build, 20 calls averaged)
The control must grow by 1,000 or more between sizes or the probe fails, so it can see the dimension. Allocation counts only; instructions and wall time were not measured.
Plant
Reverting the door commit on a throwaway branch fails both guards:
the_door_never_lists_the_set("SADD listed the whole set") and the probe ("SADD spent 38.0 allocations at 20 members and 2018.0 at 2,000"). With the change restored both pass.Tests (pinned by exact name in rust-ci.yml)
the_door_answers_what_it_always_answered: counts for duplicates, present and absent members, repeated removal, a move into the same key, TYPE of a set, an emptied set and nothing.the_door_never_lists_the_set: records the commands the door issues; none isSetMembers, and the lookup it needs is issued.probe::the_door_allocates_the_same_over_twenty_members_and_over_two_thousand(alloc-probe, ignored).No limit is introduced. Not covered:
SPOP,SRANDMEMBER,SSCANand the set algebra commands still list the set.Reused:
SetIsMemberandSetCardfrom #3148, the RESP test pattern, the alloc probe. Net: about 30 lines of door code changed, one 20-line helper, the rest tests.🤖 Generated with Claude Code