Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1653: Correct scale caching mechanism. #1692

Merged
merged 4 commits into from
Apr 25, 2024

Conversation

TimFelixBeyer
Copy link
Contributor

Fixes #1653: We cannot use the name of a ConcreteScale to cache the scales as there are sometimes different scales with the same name but different pitches. Using the pitch list and names now to be more precise and avoid collisions.
Also adds a regression test. (and a small unrelated simplification).

We cannot use the name of a ConcreteScale to cache the scales as there are sometimes different scales with the same name.
Using the pitch list and names now to be more precise and avoid collisions (cuthbertLab#1653).
@coveralls
Copy link

coveralls commented Feb 29, 2024

Coverage Status

coverage: 93.034% (+0.002%) from 93.032%
when pulling cb0223e on TimFelixBeyer:patch-14
into d33ca3c on cuthbertLab:master.

Copy link
Member

@mscuthbert mscuthbert left a comment

Choose a reason for hiding this comment

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

Thanks. Good catch. I ran tests here myself, but try to make sure when making changes to a caching system (which is generally there for necessity) that the use of the cache is still tested (generally with timing tests to back it up). This slows down the creation of roman numerals by 8%, which is acceptable given the bug it fixes. If it slowed it down by 200% then we would need to make some other fixes (such as id hashing, etc.)

if not self.useImpliedScale:
useScale = self._scale
else:
if self.useImpliedScale:
Copy link
Member

Choose a reason for hiding this comment

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

perhaps a bit more elegant, but this change is not really in the scope of the PR. :-)

@mscuthbert mscuthbert merged commit c5e3ca3 into cuthbertLab:master Apr 25, 2024
7 checks passed
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.

Repeated calls of ConcreteScale() and romanNumeral return wrong romanNumeral object
3 participants