Monday, May 23, 2022 [Tweets] [Favorites]

Combine’s .collect(.byTime) Timer

Jesse Grosjean:

The biggest bug in Bike’s 1.0 release was excessive CPU use while in background.

[…]

First, I didn’t realize that each time you use .collect(.byTime) you are setting up a new repeating timer. I had expected a timer was involved, but thought it would only get scheduled when new items were coming into the publisher. Nope, it’s repeating once the pipeline is setup.

[…]

I’ve posted a .collect(.byTime) replacement (for my use case) here. It solves the problem by only scheduling on the runloop once per group of incoming results.

Previously:

1 Comment

Mayson Lancaster

Bike 1.0.1 was just released.

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment