Repository navigation
cli: keep packages loaded between batch commands - #28
Open
WiFiGUY512 wants to merge 1 commit into
Open
WiFiGUY512 wants to merge 1 commit into
WiFiGUY512 wants to merge 1 commit into
Conversation
uci batch unloaded every loaded package after each command, so the next command loaded its package again: it parsed the config file and replayed the package's whole saved delta, which every set in the batch makes one line longer. A batch of n sets therefore took time quadratic in n or worse. On an Arista W-118 (IPQ4019) one section and one option per entry took 0.36 s for 100 entries, 11 s for 500 and 528 s for 2000; committing the 1000 deltas of 500 entries took 0.06 s of it. Keep a package loaded after a command that succeeded: the command has saved its changes, and the package in memory is the saved state. Unload everything after a command that failed, which may have left a package half changed, and before the commands that read a whole package (show, changes, export, commit) or load one themselves (import), so they see what they saw before. add uses the package when the batch has it loaded already, as uci_load() refuses a loaded one. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Christopher Griffin <christophergriffin05@gmail.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.
uci batchunloaded every loaded package after each command, so the next command loaded its package again: it parsed the config file and replayed the package's whole saved delta, which everysetin the batch makes one line longer. A batch of n sets therefore took time quadratic in n or worse.On an Arista W-118 (IPQ4019), with one section and one option per entry:
Committing the 1000 deltas of 500 entries took 0.06 s of it.
This commit keeps a package loaded after a command that succeeded: the command has saved its changes, and the package in memory is the saved state. It unloads everything:
adduses the package when the batch has it loaded already, asuci_load()refuses a loaded one.Tested on the W-118 with OpenWrt main:
🤖 Generated with Claude Code