salu133445 / muspy

A toolkit for symbolic music generation
https://salu133445.github.io/muspy/
MIT License
435 stars 51 forks source link

Reduce number of len calls #71

Open blankRiot96 opened 2 years ago

blankRiot96 commented 2 years ago

Hey, I was looking through the source code and happened to come across this really small efficiency improvement opportunity. Basically instead of getting the length of the iterable every iteration and subtracting one from it to get the last index, I thought it may be better to calculate it outside the for-in loop. First time here 👀