Loading
perf: implement lazy string key conversion for field validation
Summary
Optimize the field validation path by avoiding upfront Set creation on every log call.
Changes
- Iterate directly over
data.keysin LogInterceptor, converting to string lazily when checking against the deprecated fields lookup - Pass raw data hash to
Registry#check_for_removed_offensesinstead of pre-converted Set - Registry now only converts keys to Set when a baseline exists for the callsite (rare case)
Expected Performance Improvement
This avoids allocating a Set and converting all keys to strings on every log call when no deprecated fields are present (the common case).
- ~10-15% reduction in object allocations per log call
- Eliminates
data.keys.to_set(&:to_s)call in the hot path - Set conversion only happens when there's a baseline to check (rare)
Relates-to: #60 (closed)