ds300 / jetzt

Speed reader extension for chrome
Other
485 stars 124 forks source link

Memory bug when trying to read a long text #163

Open ofou opened 6 years ago

ofou commented 6 years ago

Hello guys! :hand: I was trying to read a book from Gutenberg website (209k words) but it crashed due to memory issues and I tried with another long text (about a 28k words) it can be read it but unfortunately becoming slow and not displaying the text at an actual or real WPM. Do you experience the same issue? :frowning_face:

I checked Chrome Dev performance on the second text and it showed this

image

toNode: function(word) {
    var node = dom.makeDiv({'class': 'word'});
    node.word = w.parseSQInstructionsForWord(word, node);

    var orpIdx = w.getORPIndex(node.word);

    node.word.split('').map(function charToNode(char, idx) {
      var span = dom.makeEl('span', {}, node);
      span.textContent = char;
      if(idx == orpIdx){
        span.classList.add('orp');
        node.orp = span;
      }
    });

    node.delayFactor = w.getDelay(node);

    return node;
  },