perf: use yaml.CSafeLoader/CDumper for 4x faster virtual index merge #39
Reference in New Issue
Block a user
Delete Branch "benvin/issue-34-csafeloader-cdumper"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #34
Summary
try/exceptselectsyaml.CSafeLoader/yaml.CDumper(C extensions) when libyaml is available, otherwise falls back toyaml.SafeLoader/yaml.Dumper_HelmDumperinherits from whichever dumper base was selected — custom datetime/date representers are registered the same way as before_merge_helm_indexesusesyaml.load(raw_data, Loader=_YamlLoader)instead ofyaml.safe_loadyaml.dump(...)call — it already passesDumper=_HelmDumper, which now inherits from the C base when availableTestYamlExtensionSelectioncover: loader/dumper base are classes,_HelmDumperinherits from the selected base, C extensions used when available, loader can parse YAMLMeasured performance gain
19-member
helm-allvirtual repo, real upstream data, Docker (AlmaLinux 9):merge=timeLocal microbenchmark (500 charts × 10 versions × 19 members, 3 runs avg):
Test plan
make test)uv build --wheel)yaml.CSafeLoader: <class 'yaml.cyaml.CSafeLoader'>