pyvider
2026-03-21
Cache Protobuf Schema Conversions by Identity
26 files · 1,366+ · 1,365-
Cache Protobuf Schema Conversions by Identity
26 files changed
schema_adapter.pyUpdated schema_adapter.py (+28/-4 lines)baselines.jsonUpdated baselines.json (+3/-3 lines)ci.ymlUpdated ci.yml (+3/-3 lines).gitignoreAdded .gitignore (+6 lines)VERSIONUpdated VERSION (+1/-1 lines)pyproject.tomlUpdated pyproject.toml (+2/-1 lines)availability.pyUpdated availability.py (+1/-1 lines)decorators.pyUpdated decorators.py (+2/-1 lines)decorators.pyUpdated decorators.py (+1/-1 lines)adapters.pyUpdated adapters.py (+3/-1 lines)handler.pyUpdated handler.py (+1/-1 lines)discovery.pyUpdated discovery.py (+1/-1 lines)validators.pyUpdated validators.py (+4/-2 lines)service.pyUpdated service.py (+5/-5 lines)function_adapter.pyUpdated function_adapter.py (+1/-1 lines)apply_resource_change.pyUpdated apply_resource_change.py (+2/-2 lines)call_function.pyUpdated call_function.py (+11/-4 lines)plan_resource_change.pyUpdated plan_resource_change.py (+3/-3 lines)decorators.pyUpdated decorators.py (+1/-1 lines)enums.pyUpdated enums.py (+3/-3 lines)test_availability.pyUpdated test_availability.py (+2/-2 lines)conftest.pyUpdated conftest.py (+6/-143 lines)test_conversion_memory.pyUpdated test_conversion_memory.py (+9/-10 lines)test_hub_memory.pyUpdated test_hub_memory.py (+9/-10 lines)test_schema_memory.pyUpdated test_schema_memory.py (+9/-10 lines)uv.lockUpdated uv.lock (+1249/-1151 lines)
- Added
_proto_block_cache: dict[int, tuple[PvsObjectType, pb.Schema.Block]] = {}insrc/pyvider/conversion/schema_adapter.pystreamline internal1 file
schema_adapter.py
- Added
_proto_schema_cache: dict[int, tuple[PvsSchema, pb.Schema]] = {}in the same file streamline internal14 files
.gitignoreVERSIONpyproject.tomlschema_adapter.pyservice.pyapply_resource_change.pyplan_resource_change.pyenums.pybaselines.jsonconftest.pytest_conversion_memory.pytest_hub_memory.pytest_schema_memory.pyuv.lock
- Cache stores
(source_obj, proto_result)tuples keyed byid(source_obj)— the source reference in the tuple prevents CPython from reusing the id via garbage collection (prevents stale cache hits) streamline internal14 files
.gitignoreVERSIONpyproject.tomlschema_adapter.pyservice.pyapply_resource_change.pyplan_resource_change.pyenums.pybaselines.jsonconftest.pytest_conversion_memory.pytest_hub_memory.pytest_schema_memory.pyuv.lock
isguard on lookup: checks that the cached entry’s source object is the same object instance, not just the same id value, to handle any GC edge cases streamline internal14 files
.gitignoreVERSIONpyproject.tomlschema_adapter.pyservice.pyapply_resource_change.pyplan_resource_change.pyenums.pybaselines.jsonconftest.pytest_conversion_memory.pytest_hub_memory.pytest_schema_memory.pyuv.lock
- Result: hub-level allocations drop from 72K → 10.6K per 5K schema conversions (85% reduction)
deprecate
internal
14 files
.gitignoreVERSIONpyproject.tomlschema_adapter.pyservice.pyapply_resource_change.pyplan_resource_change.pyenums.pybaselines.jsonconftest.pytest_conversion_memory.pytest_hub_memory.pytest_schema_memory.pyuv.lock
- Baselines in
tests/memray/baselines.jsonupdated:hub_total_allocations66404 → 10589 qualify internal1 file
baselines.json
Guard Expensive Debug Call Arguments
14 files changed
.gitignoreChanges to .gitignoreVERSIONChanges to VERSIONpyproject.tomlChanges to pyproject.tomlschema_adapter.pyChanges to schema_adapter.pyservice.pyChanges to service.pyapply_resource_change.pyChanges to apply_resource_change.pyplan_resource_change.pyChanges to plan_resource_change.pyenums.pyChanges to enums.pybaselines.jsonChanges to baselines.jsonconftest.pyChanges to conftest.pytest_conversion_memory.pyChanges to test_conversion_memory.pytest_hub_memory.pyChanges to test_hub_memory.pytest_schema_memory.pyChanges to test_schema_memory.pyuv.lockChanges to uv.lock
- Wrapped
debug()calls that require constructing expensive arguments (beyond f-string formatting) withis_debug_enabled()guards decouple errata14 files
.gitignoreVERSIONpyproject.tomlschema_adapter.pyservice.pyapply_resource_change.pyplan_resource_change.pyenums.pybaselines.jsonconftest.pytest_conversion_memory.pytest_hub_memory.pytest_schema_memory.pyuv.lock
- Prevents object allocation and method calls that occur even when debug logging is disabled
decouple
behavioral
14 files
.gitignoreVERSIONpyproject.tomlschema_adapter.pyservice.pyapply_resource_change.pyplan_resource_change.pyenums.pybaselines.jsonconftest.pytest_conversion_memory.pytest_hub_memory.pytest_schema_memory.pyuv.lock
Migrate Memray Infra to Shared Module
1 file changed
wrknv.memrayUpdated wrknv.memray
- Migrated memray profiling infrastructure to the shared
wrknv.memraymodule streamline internal1 file
wrknv.memray
- Centralizes profiling setup, baseline loading, and assertion helpers across the pyvider family
streamline
internal
14 files
.gitignoreVERSIONpyproject.tomlschema_adapter.pyservice.pyapply_resource_change.pyplan_resource_change.pyenums.pybaselines.jsonconftest.pytest_conversion_memory.pytest_hub_memory.pytest_schema_memory.pyuv.lock