Repository navigation
perf: grow the request queue's dedup cache from 8 KiB, keeping every key up to 3.1M - #30
Merged
Merged
Conversation
…key up to 3.1M The cache was a fixed 1M-slot direct-mapped table (8 MiB from the first add), so keys that landed in the same slot replaced each other: it kept 95% of 100k keys, 64% of 1M and 45% of 2M, where the LRU of JS keeps up to 2M exactly. Each forgotten key costs a backend add when it is seen again. It is now a hash table of the same 64-bit fingerprints with linear probing. It starts at 8 KiB on the first add and doubles at 3/4 full, placing the keys again from their fingerprints, up to 4M slots (32 MiB): every key is kept up to about 3.1M. Past that, a new key replaces the one in its home slot, so the table stays at most 3/4 full. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0148RYR4BTGyCYHENSRZjC3S
…'s type_complexity master's check job fails on it since #29. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0148RYR4BTGyCYHENSRZjC3S
Member
Author
|
The Generated by Claude Code |
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.
The request queue's add-deduplication cache was a fixed 1M-slot direct-mapped table: 8 MiB from the first add, and keys landing in the same slot replaced each other. It kept 95% of 100k keys, 64% of 1M and 45% of 2M, where the LRU of Crawlee for JS keeps up to 2M requests exactly. A forgotten key costs a backend add when the crawl sees it again.
It is now a hash table of the same 64-bit fingerprints (handled flag in the lowest bit), with linear probing:
Same crawl pattern on both (add, 4 re-adds, mark handled; release build):
The
allowed-differences.mdrow is rewritten to match, and now describes the two JS caches precisely: which adds fill and read each, and that JS's full keys never report an unseen request as present while fingerprints could (about 2^-63 a lookup).Generated by Claude Code