gustafl / lexeme

A new take on language learning.
1 stars 0 forks source link

Write benchmark where every word is highlighted #108

Open gustafl opened 8 years ago

gustafl commented 8 years ago

The new auto-highlighter turned out to be pretty fast. Even with 2 chapters loaded, it takes 25 ms on average to highlight all instances of the most common word. But what if we highlight all of the 1613 unique words? Will this be a performance hog? Develop a benchmark where every word is highlighted in frequency (or fully random) order.

gustafl commented 8 years ago

On second thought, this benchmark won't be realistic unless it reads words and lexical categories from local storage. So we first need to write some code to add all unique words to local storage (using random lexical categories). Then we read them from local storage in any order.

gustafl commented 8 years ago

If highlighting words from local storage turns out to be a performance hog (which seems likely at this point), we need to start thinking about how to give proper feedback to the user during the process. This should be easy because there is an obvious loop with a known set of iterations which we can feed into a progress bar or something.

gustafl commented 8 years ago

In the not too distant future, we will also need to take into account any user resolved conflicts (between homographs etc). I have not yet decided how to store these, but it's reasonable to assume they will be stored in a separate record type in local storage. When the document is loaded and the auto-highlighter starts looping through the words in local storage, each word also needs to be checked against this table of resolved conflicts.