8 ms·
Is a 400 thousand word text file "very basic"?
by t0astbread 7y ago
Is a 400 thousand word text file "very basic"?
- ggambetta 7y agoNo, the "very basic test" is not having a 10 second latency in a text editor. Come on, this was a solved problem in the 90s.
- t0astbread 7y agoIf it was a solved problem in the 90s, can't you just use a text editor from the 90s? No need to bash on this project just because it doesn't fulfill your use case.
- ggambetta 7y agoBecause there's contemporary Markdown editors that do work as expected. I didn't bash this one, I asked.
- z3t4 7y agoWhat editor did you end up with? Modern editors are fairly complex. Splitting a bitbuffer and showing ascii line by line is simple. But modern editors have to deal with unicode, where some characters (surrogates) are two chars long, and can be followed by modifiers such as skin color of emojis. Then some characters are wider then others. So a modern editor must first parse the string encoding, then parse the language (markdown) for further formatting and coloring or building a WYSIWYG, usually on every key stroke. The expensive part is showing the text on the screen, generating the fonts, where old editors didnt have fonts.
- ggambetta 7y agoI'm using Typora, which works pretty well for this use case. Open source, cross-platform, very nice. I'm in no way affiliated with it, I just like it :) I get the parsing difficulties. Generally, at least for markdown, pressing a character should affect only the line (paragraph) that contains it, so worst case scenario, you need to parse the entire paragraph. Worst case scenario, you need to re-render whatever fits on the screen. I refuse to believe it's not possible to do this efficiently with 2020 hardware, and I have proof, in the form of editors that work. If it's 2020, I try to append a character to a 400k file I have open, and this takes multiple seconds, it's because someone implemented Schlemiel the Painter's Algorithm, not because the hardware is slow or the file is too big.
- enriquto 7y agoYes, it is. This is a quite typical size of a book. Typically novels have about 100 thousand words, but four times that size is not at all uncommon.
- jfkebwjsbx 7y agoBooks should not be written in a single text file, though. That is asking for trouble.
- enriquto 7y agoWhy not? Beacuse of bad text editors? Or is there some fundamental reason about that?
- jfkebwjsbx 7y agoBecause it is extremely hard to work with it? Same reason why we do not put programs in a single source file.
- omaranto 7y agoWhy is it extremely hard to work with the whole novel in a single file? Because most software for writing prose is not up to the task?
- omaranto 7y agoA good editor can handle them without any trouble. I just downloaded Moby Dick from Project Gutenberg and opened it in Emacs. It opened instantly, I could immediately go the end (line 22333), scroll around, count the words (there are around 222617), count the ocurrences of the word 'whether' (there are 91, the last of which is on line 21769), make a change somewhere in the middle. All of this is instant. You can do all that instantly in Vim too (... and I just checked to make sure). A megabyte of text is just not a lot of text for a good editor.
- weeksie 7y ago
- mellavora 7y agobreak the novel into chapters? Each chapter in a separate md file?