⚡ Bolt: Remove redundant deepcopy in JSON processing #4
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.
⚡ Bolt: Remove redundant deepcopy in JSON processing
💡 What:
Removed
copy.deepcopy(data)calls inmask_json,redact_json, andprocess_json_with_modeinapp/services/json_processor.py.🎯 Why:
The
process_json_recursivefunction iterates through the input data and builds a new result structure (dictionary or list) as it goes. Therefore, pre-copying the data is redundant. For large JSON payloads,deepcopyis expensive in both CPU and memory.📊 Impact:
🔬 Measurement:
Verified with
pytest tests/test_json_mode.pyto ensure correctness and no regressions in JSON processing logic.Verified with a benchmark script that 50k item list processing time dropped from ~1.36s to ~0.81s.
PR created automatically by Jules for task 14825583765337528993 started by @kiku-jw