-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Lazy Chord loading on Key Type #23
Comments
These sound like good solutions. Thank you for pushing on this. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
From what I understand, when you initialize a
Key
, all the chords are generated inside the init.However, if you want to create all the available keys for a certain note, the performance is pretty bad.
Here is a piece of code that illustrates this concept:
This code creates an array of keys for all the scales of a given note.
Proposed Solution
I would suggest implementing lazy chord creation. This would allow users to request the chords for a specific key only when needed, instead of generating them automatically during initialization. I believe that generating chords during initialization is unnecessarily complex and pollutes the domain of the
Key
Object, in addition, it also impacts the performance.We could also think about adding a static global cache, similar to
Chordtable
, that stores a key and all the corresponding chords globally for faster access.Wdyt?
The text was updated successfully, but these errors were encountered: