Stop persisting Spellups on every checkExist call#100
Open
rodarvus wants to merge 1 commit into
Open
Conversation
checkExist() ensures a key exists in the Spellups table and was also
calling SetVariable("Spellups", serialize.save("Spellups")) every
time it added a missing key. injectVars() calls checkExist dozens of
times in a row on startup, so the full table was being serialized
and written to state once per key.
Drop the SetVariable call -- OnPluginSaveState already persists
Spellups (via serialize.save_simple) at shutdown, plugin disable,
and the normal MUSHclient save points. As a side effect this also
removes the only call to serialize.save("Spellups") (the name-based
variant), leaving serialize.save_simple as the single writer, which
matches what the loadstring on the read path expects.
Also tidies the over-indented assignment inside the if-branch.
Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Summary
checkExist()inSpellupRecast/Hadar_Spellups.xmlensures a key exists in theSpellupstable and was also callingSetVariable("Spellups", serialize.save("Spellups"))every time it added a missing key. BecauseinjectVars()callscheckExistdozens of times in sequence on startup, the fullSpellupstable was being serialized and written to plugin state once per key — measurable I/O churn for no benefit on a fresh install or version bump.This drops the
SetVariablecall.OnPluginSaveStatealready persistsSpellups(viaserialize.save_simple) at shutdown, plugin disable, and the standard MUSHclient save points, so the data still reaches disk — just once, at the right time.As a side effect this also removes the only call to
serialize.save("Spellups")(the name-based variant), leavingserialize.save_simpleas the single writer. That matches what theloadstringreader inOnPluginEnablealready expects, so the read/write paths are now consistent.The over-indented assignment inside the
ifbranch is also tidied.Before
After
Test plan
OnPluginSaveState(line 544) is the canonical writer;checkExist's SetVariable was redundant.🤖 Generated with Claude Code