Skip to content

Faster event aggregator -> rates#24

Merged
cboulay merged 6 commits intodevfrom
cboulay/refactor_rate_calc
Dec 2, 2025
Merged

Faster event aggregator -> rates#24
cboulay merged 6 commits intodevfrom
cboulay/refactor_rate_calc

Conversation

@cboulay
Copy link
Copy Markdown
Member

@cboulay cboulay commented Dec 2, 2025

It's been a few months since I last looked at this code and I can't remember what prompted it. I think the current event->rate calculation is slow and this is a faster version, but I can't recall with certainty.

@cboulay cboulay requested a review from Copilot December 2, 2025 05:49
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the event rate calculation to improve performance by replacing the generator-based implementation with a composite processor architecture and introducing a new BinnedEventAggregator for more efficient event binning.

Key changes:

  • Refactored EventRate from generator-based to composite processor pattern using composition of smaller transformers
  • Added new BinnedEventAggregator with optimized binning logic that handles overflow states
  • Created reusable Aggregate transformer for axis-based aggregation operations

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/ezmsg/event/rate.py Replaced generator-based rate calculation with composite processor architecture using WindowTransformer, Aggregate, RenameAxis, and DensifyAndScale components
src/ezmsg/event/binned.py Added new BinnedEventAggregator with stateful processing for efficient event binning with overflow handling
src/ezmsg/event/aggregate.py Created new Aggregate transformer for performing sum/mean operations along specified axes
src/ezmsg/event/init.py Updated exports to include new Rate, EventRate, Aggregate, and BinnedEventAggregator classes
tests/test_rate.py Renamed test function, updated to use new API, added performance assertions, and created comprehensive test for BinnedEventAggregator

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/test_rate.py Outdated
Comment thread src/ezmsg/event/aggregate.py Outdated
Comment thread src/ezmsg/event/binned.py Outdated
@cboulay cboulay marked this pull request as ready for review December 2, 2025 07:04
@cboulay cboulay merged commit eb40d46 into dev Dec 2, 2025
@cboulay cboulay deleted the cboulay/refactor_rate_calc branch December 2, 2025 07:07
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.

2 participants