Skip to content

Commit 4d7aac4

Browse files
docs: note O(N) re-parse is consistent with yamlpatch behavior
1 parent 00b79e2 commit 4d7aac4

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/document.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,12 @@ pub(crate) fn apply_patches_impl(
181181
batch.clear();
182182
}
183183

184-
// Apply the complex replace directly
184+
// Apply the complex replace directly.
185+
// NOTE: This re-parses the document for each complex replace (O(N) parses).
186+
// This is consistent with yamlpatch::apply_yaml_patches, which also
187+
// re-parses per patch via apply_single_patch. A bottom-up single-pass
188+
// approach could avoid this, but isn't warranted until profiling shows
189+
// it matters.
185190
let route = patch.route.to_yamlpath_route();
186191
let value = match &patch.operation.inner {
187192
yamlpatch::Op::Replace(v) => v,

0 commit comments

Comments
 (0)