SpeedcuberOSS / speedcuber-timer

The smart, offline-ready speedcubing Android/iOS app made for speedcubers, by speedcubers.
Mozilla Public License 2.0
3 stars 0 forks source link

perf: Only keep bluetooth messages in-memory while running an attempt #88

Closed thehale closed 1 year ago

thehale commented 1 year ago

Smartcubes with Gryoscopes (e.g. GoCube Edge) generate thousands of messages per minute. Holding onto all those messages over the course of a multi-hour solve session could lead to running out of memory.

The messages are only stored in-memory so that they can be grabbed as a batch to persist alongside a completed Attempt. We can improve performance by only storing messages in-memory when an attempt is running.

thehale commented 1 year ago

Consider removing the messages attribute from PuzzleRegistryEntry and instead requiring all parties interested in messages to register a listener.

With that implementation, the PracticeView can register a listener when an attempt starts and remove it when done.