perf: add JSON sidecar for data model loading (~100x faster) - #898
Closed
ChristopherJHart wants to merge 1 commit into
Closed
perf: add JSON sidecar for data model loading (~100x faster)#898ChristopherJHart wants to merge 1 commit into
ChristopherJHart wants to merge 1 commit into
Conversation
ChristopherJHart
force-pushed
the
fix/perf-json-sidecar
branch
from
August 17, 2026 20:56
91cc872 to
c82aeb7
Compare
The merged data model YAML file is re-parsed by every test subprocess using ruamel's pure-Python parser (1.9s per test on a 2.3MB file). This adds a JSON sidecar (.cache.json) written once by the orchestrator and read by tests via json.load() (~0.005s). The orchestrator writes both YAML and JSON at merge time. load_data_model() prefers the JSON sidecar when present and fresh, falling back to YAML if missing or stale. If a test is the first to run (no sidecar), it writes one after parsing YAML so subsequent tests benefit. Measured: 1.9s -> 0.017s per test (112x improvement on data model loading). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ChristopherJHart
force-pushed
the
fix/perf-json-sidecar
branch
from
August 17, 2026 21:14
c82aeb7 to
01e4c28
Compare
oboehmer
reviewed
Aug 31, 2026
Collaborator
There was a problem hiding this comment.
@ChristopherJHart , please check #931 (comment) for an alternative approach.. TLDR: I would just create merged_data_model_test_variables.json already in main and promote it as a first-class artifcat, with the option to deprecate the .yaml format altogether..
42 tasks
Contributor
Author
|
Closing in favor of #933 |
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
Adds a JSON sidecar cache for the merged data model, eliminating repeated YAML parsing across test subprocesses.
Problem
Every test subprocess re-parses the merged data model YAML file using ruamel's pure-Python parser (
YAML(typ="safe", pure=True)). On a 2.3 MB file, this takes 1.9 seconds per test. For a 169-test device, that's 322 seconds (48% of total setup time) spent re-parsing the same unchanging file.Solution
.cache.jsonsidecar alongside the YAML at merge timeload_data_model()prefers the JSON sidecar when present and fresh (mtime check)Measured Impact
Files Changed
nac_test/data_merger.pynac_test/pyats_core/common/base_test.pyload_data_model()Test plan
🤖 Generated with Claude Code