3 ms·
A more interesting question is, how do you do spellchecks lazily and efficiently on arbitrarily large documents that's being edited in real-time? Rerun on modif
by sansnomme 8y ago
A more interesting question is, how do you do spellchecks lazily and efficiently on arbitrarily large documents that's being edited in real-time? Rerun on modified sentence? Paragraph?
- saghm 8y agoGiven for most editors, a cursor can only be in a single place at a given time, you really only need to check the word where the cursor is (i.e. where the most recent change happened) in real time to make it appear instant to most use cases. I'd bet that if you pasted a large amount of text into the average editor at once, the spell check would take a bit longer to "catch up".
- Someone 8y agoAlso, even if you paste a large amount of text, spell checking likely can be done as good as instantaneously. Think of it: - whatever you use to indicate spelling errors should not affect text layout, so you can layout the text on the screen in a single thread while another thread spell-checks it and adds markers where needed. - You only have to spell-check what is on the screen, say 2,500 words max. - short words likely are spell-checked in about zero time, and longer words fill the screen more rapidly, so you can have fewer. - modern CPUs are crazily fast. I suspect sansnomme’s question is about grammar-checking/more advanced linguistic analysis, though. For that, “you only have to check what’s on the screen” and “modern CPUs are crazily fast” still apply.