Repository navigation
perf: don't write auto-saved values or recoverable state that did not change - #29
Merged
Merged
Conversation
… change `get_auto_saved_value` values (the SDK's `Actor::use_state`) were written again on every `persistState` event, changed or not. Each now remembers the record it last saved, loaded or was set to, and is written only when it differs. Both auto-saved values and `RecoverableState` also count a missing record as holding the initial state, which a run would restore to anyway: a state that never changes is never written (before, its default was written once). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0148RYR4BTGyCYHENSRZjC3S
metalwarrior665
pushed a commit
that referenced
this pull request
Nov 18, 2026
…'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
metalwarrior665
added a commit
that referenced
this pull request
Nov 18, 2026
…key up to 3.1M (#30) * perf: grow the request queue's dedup cache from 8 KiB, keeping every 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 * chore: name the type of an auto-saved value's last record, for clippy'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 --------- Co-authored-by: Claude <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.
persistState. This coversKeyValueStore::get_auto_saved_value, which the SDK'sActor::use_stateuses. Every value was written on every event, changed or not, at the periodic saves, a migration, an abort and the end of a run. In google-maps-rs that rewrote ENQUEUEING_STATE every minute. Each auto-saved value now remembers the record it last saved, loaded or wasset_valued to, and is written only when it differs.RecoverableState(the crawler's statistics, request-list position and session pool) now count a missing record as holding the initial state, which a run would restore to anyway. Before, the default was written once.Tests:
auto_saved_values_are_written_only_when_they_changecovers a default left unchanged, a loaded value, a change, and a value set on the key.an_unchanged_state_is_not_saved_againandsaves_on_an_interval_when_the_state_changedare updated for the initial state. The first two failed before the change.Generated by Claude Code