musicbrainz/picard — pull request #126 by mwiencek (2013-06-15 06:35:27+00:00)
Title: Add @throttle decorator to reduce the number of GUI updates

This basically ensures that, if a function that updates the GUI is called many times in a certain interval, it'll only execute once. I explain why I wrote this in https://github.com/musicbrainz/picard/pull/108#issuecomment-19221509.

The decorator executes its function in the same thread as it was called, so there shouldn't be any surprises there.

I haven't made any performance measurements, but drag-selecting albums "feels" a lot less laggy, and so does removing a bunch of them. Logging statements showed that it blocks a *lot* of calls in those scenarios.

The intervals I picked are somewhat arbitrary, but feel right to me.

This was tested on Mac and Windows.