kaegi / MorphMan

Anki plugin that reorders language cards based on the words you know
Other
262 stars 66 forks source link

improved the lookups of the frequency list from O(n) to average O(1). Thi… #119

Closed dmgerman closed 4 years ago

dmgerman commented 4 years ago

The current code complexity when looking up the position of a word in the frequency list is O(n). This operation is done one per card to analyze. The new code changes this complexity to average O(1). This will result in a much faster update of cards for a large frequency list.

The implementation is simply replacing a list lookup with a dictionary lookup.