pyvider-cty 2026-03-21
Micro-optimizations in conversion and codec hot paths with memray infrastructure
32 files · 2,177+ · 899-

Allocation-reduction optimizations in hot paths

8 files changed
  • codec.py +32 -50 lines
  • adapter.py +30 -7 lines
  • raw_to_cty.py +104 -77 lines
  • list.py +11 -22 lines
  • map.py +12 -21 lines
  • string.py +22 -31 lines
  • object.py +34 -43 lines
  • recursion.py +64 -100 lines
  • Replaced list.extend([a, b]) patterns with two list.append() calls in collection type modules to avoid temporary list allocation streamline internal
    3 files
    • list.py
    • map.py
    • object.py
  • Replaced list(dict.values()) with direct reversed(dict.values()) to eliminate intermediate list allocation streamline internal
    2 files
    • map.py
    • object.py
  • Cached structural key tuples for recurring primitive values to avoid repeated tuple construction in codec and type modules streamline internal
    1 file
    • codec.py
  • Replaced per-call lambda expressions with module-level function definitions in raw_to_cty.py and type modules streamline internal
    1 file
    • raw_to_cty.py
  • Replaced sorted(list(iterable)) with sorted(iterable) to remove redundant intermediate list streamline internal
    1 file
    • raw_to_cty.py
  • Removed error_boundary context manager wrapping from serialization and deserialization paths to reduce per-call overhead streamline internal
    1 file
    • codec.py

Memray stress-testing infrastructure

9 files changed
  • memray_analysis.py +244 -0 lines
  • memray_codec_stress.py +126 -0 lines
  • memray_conversion_stress.py +133 -0 lines
  • memray_inference_stress.py +98 -0 lines
  • memray_unify_stress.py +97 -0 lines
  • memray_validation_stress.py +141 -0 lines
  • run_memray_stress.py +107 -0 lines
  • test_validation_memory.py +17 -0 lines
  • test_spec_compliance.py Modified
  • Added seven memray stress scripts covering codec, conversion, inference, unify, validation, and aggregate analysis qualify internal
    7 files
    • memray_analysis.py
    • memray_codec_stress.py
    • memray_conversion_stress.py
    • memray_inference_stress.py
    • memray_unify_stress.py
    • memray_validation_stress.py
    • run_memray_stress.py
  • Added memray validation memory test and excluded memray tests from default pytest run qualify internal
    2 files
    • test_validation_memory.py
    • test_spec_compliance.py

Dependency pinning and build configuration

5 files changed
  • VERSION +1 -1 lines
  • pyproject.toml +10 -2 lines
  • uv.lock +609 -550 lines
  • wrknv.toml +4 -0 lines
  • Makefile +42 -0 lines
  • Pinned provide-foundation>=0.3.21,<0.4 in pyproject.toml and regenerated lock file baseline internal
    2 files
    • pyproject.toml
    • uv.lock
  • Bumped version to 0.3.21 and added Makefile for build tasks baseline internal
    2 files
    • VERSION
    • Makefile
  • Updated wrknv.toml workspace configuration baseline internal
    1 file
    • wrknv.toml

Type checking and formatting fixes

4 files changed
  • .actrc +12 -16 lines
  • .gitignore +6 -0 lines
  • HANDOFF.md +119 -0 lines
  • pyproject.toml Modified
  • Suppressed msgpack import-untyped mypy error and added msgpack to mypy ignore list remediate internal
    1 file
    • pyproject.toml
  • Applied ruff 0.15.7 formatting across memray tests baseline internal
    7 files
    • __init__.py
    • conftest.py
    • test_codec_memory.py
    • test_conversion_memory.py
    • test_inference_memory.py
    • test_unify_memory.py
    • test_validation_memory.py
  • Updated .actrc configuration and added .provide/HANDOFF.md baseline internal
    3 files
    • .actrc
    • .gitignore
    • HANDOFF.md