Skip to content

feat(bench): add tracemalloc memory benchmarks for parser modules#90

Merged
Oaklight merged 1 commit into
masterfrom
feature/bench-memory-peak
May 18, 2026
Merged

feat(bench): add tracemalloc memory benchmarks for parser modules#90
Oaklight merged 1 commit into
masterfrom
feature/bench-memory-peak

Conversation

@Oaklight
Copy link
Copy Markdown
Owner

Summary

  • Adds test_<module>_memory.py for soup, yaml, xml, multipart, readability, and protobuf (closes Benchmark: add memory peak measurement for parser modules #84, closes Benchmark: add memory peak measurement for parser modules #85)
  • Uses stdlib tracemalloc only — no new dependencies, no pytest-benchmark
  • Each file covers S/M/L input sizes consistent with the existing time benchmarks
  • Reports peak allocation in KB; zerodep-vs-reference comparison tests are included wherever the reference library is available (bs4, PyYAML, xmltodict, readability-lxml); skipped otherwise
  • protobuf: google-protobuf comparison tests exist but are skipped when the MessageFactory.GetPrototype API is unavailable in the installed version

Test plan

  • conda run -n zerodep pytest soup/test_soup_memory.py yaml/test_yaml_memory.py xml/test_xml_memory.py multipart/test_multipart_memory.py readability/test_readability_memory.py protobuf/test_protobuf_memory.py -v -s → 74 passed, 2 skipped
  • ruff check --fix → clean
  • ruff format → no changes
  • pre-commit hooks (ruff, ty, complexipy) → all passed

…oses #84, closes #85)

Add test_<module>_memory.py for soup, yaml, xml, multipart, readability,
and protobuf.  Each file uses stdlib tracemalloc to record peak heap
allocation (reported in KB) for S/M/L inputs, with zerodep-vs-reference
comparison tests where the reference library is available.  No
pytest-benchmark dependency; plain pytest with -s prints results inline.
@Oaklight Oaklight merged commit afd705d into master May 18, 2026
6 checks passed
@Oaklight Oaklight deleted the feature/bench-memory-peak branch May 18, 2026 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Benchmark: add memory peak measurement for parser modules Benchmark: add memory peak measurement for parser modules

1 participant