Skip to content

Conversation

@mscuthbert
Copy link
Member

@mscuthbert mscuthbert commented Jun 3, 2022

see post to music21list about details.

Switches the cache from 1024 to None -- not because we want to cache more than 1024 values, but to avoid the overhead of an LRU cache, which is significant.

Speeds up opFrac(0.5) by about 37% by giving a set of 20 values to return very quickly at a cost of adding 25% to opFrac(9/16) or 5% to opFrac(1/3) -- worth it -- though the lru_cache speedup makes the latter actually faster.

opFrac is the performance bottleneck of music21, so anything to speed it up is a big win.

see post to music21list about details.

Switches the cache from 1024 to None -- not because we want to cache more than 1024 values, but to avoid the overhead of an LRU cache, which is significant.

Speeds up opFrac(0.5) by about 37% at a cost of adding 25% to opFrac(9/16) or 5% to opFrac(1/3) -- worth it -- though the lru_cache speedup makes the latter actually faster.
@coveralls
Copy link

coveralls commented Jun 3, 2022

Coverage Status

Coverage decreased (-0.0008%) to 93.052% when pulling 1c72f13 on optimize_opFrac into dcd2374 on master.

@mscuthbert mscuthbert merged commit 9f2143c into master Jun 4, 2022
@mscuthbert mscuthbert deleted the optimize_opFrac branch June 4, 2022 00:49
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.

3 participants