Skip to content

v3.0.1 - Performance and Code Quality Improvements

Choose a tag to compare

@m96-chan m96-chan released this 11 Dec 09:10
· 5 commits to main since this release

Performance Improvements

CorrelationEngine (correlation.py)

  • O(1) event removal: Changed from list to dict-based indexing for event storage
  • Events now tracked by internal ID for constant-time removal from indexes
  • Extracted common _sort_by_timestamp() helper method

Player.seek() (recording.py)

  • Binary search: Uses bisect.bisect_left for O(log n) timestamp seeking (was O(n) linear search)
  • Pre-builds timestamp index during file load

EventBuffer.get_events() (dashboard.py)

  • Uses itertools.islice to avoid full list conversion for efficient event retrieval
  • Optimized EventSerializer with attribute mapping dictionary

EtwStreamer (streamer.py)

  • Cached event loop: Added _get_loop() helper to reduce asyncio.get_event_loop() overhead

Error Handling Improvements

OtlpFileExporter (exporters/otlp.py)

  • Atomic file writes: Uses temp file + rename pattern for crash safety
  • Added proper exception handling with logging for OSError, TypeError, ValueError

Player (recording.py)

  • Added specific exception handling for JSONDecodeError, KeyError, OSError
  • Uses logging for error diagnostics instead of silent failures

Code Quality

  • Added logging throughout for better diagnostics
  • Consistent use of type hints
  • Improved code organization with helper methods

Full Changelog: v3.0.0...v3.0.1