← Back to issue list

snapcraft does not use the C yaml parser

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1787373
Type
issue
State
closed
Author
~chipaca
Labels
—
Created
Updated
Closed

Current evaluation

Snapcraft adopted PyYAML's C parser in merged PR #2218 (commit 2e6ed7fd1), replacing yaml.safe_load() with CSafeLoader.

Resolution: closed resolved

Reason: The performance issue was fixed by PR #2218, merged as commit 2e6ed7fd1. The commit changed YAML loading to use CSafeLoader.

Evaluated by: mr-cal-bot

No scores available.

Issue body

PyYAML includes a C implementation of the yaml parser. However, yaml.safe_load does not use it: for that you need to use yaml.load(..., Loader=yaml.CSafeLoader). As snapcraft always does the former, it's very slow for big yamls. Granted big yamls should be avoided, but the performance difference is big enough to notice even in not-so-huge ones.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Snapcraft adopted PyYAML's C parser in merged PR #2218 (commit 2e6ed7fd1), replacing yaml.safe_load() with CSafeLoader.
stealth/space-bunny-alpha — closed resolved Snapcraft adopted PyYAML’s C parser in merged PR #2218, replacing yaml.safe_load() with CSafeLoader in commit 2e6ed7fd1.
stealth/space-bunny-alpha — closed resolved Snapcraft adopted PyYAML's C-based CSafeLoader; PR #2218 was merged in commit 2e6ed7fd1 to speed up YAML parsing.
qwen/qwen3.6-35b-a3b — — Closed without action or comments, the performance report regarding snapcraft's use of the slow PyYAML parser instead of the C implementation was abandoned. No fix was applied.
qwen/qwen3.6-35b-a3b — — Closed without resolution or comments. The report noted slow YAML parsing due to PyYAML's default loader. No changes were made, indicating the issue was abandoned.
qwen/qwen3.6-35b-a3b — — Closed without comments or resolution. The PyYAML C parser performance issue was abandoned. No code changes were implemented to address the slow YAML loading.
qwen3.6-35b-a3b-mtp-q6 — — Closed without resolution. The report noted that snapcraft used PyYAML's slower Python parser instead of the C implementation, causing performance issues with large YAML files. No fix or follow-up was implemented.

Update history

Date Change
created

Related work

  • Likely Fixed By: snapcore/snapcraft#2218 (confidence 100%)

    Merged PR replacing yaml.safe_load() with CSafeLoader; resolving commit 2e6ed7fd1.

Related issues

Issue Project State Summary Similarity
#1605541 snapcraft-parser doesn't work snapcraft (launchpad) closed Fixed in snapcore/snapcraft#681 by making snapcraft-parser handle CRLF-separated YAML documents.
74%
#1792049 Uncaught yaml.ParserError snapcraft (launchpad) closed YAML parser tracebacks were fixed by merged snapcore/snapcraft PR #2263 (commit 057f66649), which catches broader YAML exceptions and reports invalid YAML.
71%