Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The point is that each insertion at the start of the file would memcopy the entire buffer, though. With a few hundred mb file that sounds slow even today.

Are you sure that they don't keep a buffer of 10k lines or a gap buffer?



> With a few hundred mb file that sounds slow even today.

That depends upon how fast one can perform the memcopy of the entire buffer.

It has been said that latency amounts of 100ms are perceived as instantenous (https://www.pubnub.com/blog/2015-02-09-how-fast-is-realtime-...).

So if we take 100ms as our latency budget, then the max file size we can 'edit' with a straightforward memcopy (i.e., no gap buffer) becomes how much data the CPU can move in memory in 100ms.

With a modern CPU, moving on the order of 5-7 GiB/sec (http://jamesslocum.com/post/64209577678) a simplistic memcopy could handle editing the start of a 512MiB to 716MiB file and still feel 'instantaneous'.

With the much smaller file sizes of yesteryear (someone did mention Dos, many of the old Dos editors had a 64KiB max file size limit) in order for editing of a 64KiB file with a max latency of 100 ms required only that the CPU be capable of moving memory at a maximum of 640KiB/sec. On an 8088 IBM PC at 4.77Mhz with a 4 cycle latency per byte (https://trixter.oldskool.org/2013/01/10/optimizing-for-the-8...) the rep movsb instruction should achieve a maximum of 1164KiB/sec memory move speed. More than enough headroom to make editing a 64KiB max file appear to be instant, even using the basic memcopy method. Even if we assume 8 cycles per byte (4 to read, 4 to write) we still get 582KiB/sec of memcopy performance. Enough that editing would appear instant on all files less than 58KiB.


> It has been said that latency amounts of 100ms are perceived as instantenous (https://www.pubnub.com/blog/2015-02-09-how-fast-is-realtime-...).

Yes, but that was 50 years ago(!!!) and technology + expectations have moved on considerably since then; which that article explores. Thus my take away from that article is that 100ms is very perceivable and thus simply not fast enough for some applications.

For what it's worth, the article correlates with my own personal anecdote as well.

Going back to the original point, 100ms might still be good enough for a text editor, generally speaking. But going back to my own anecdote, I do find it highly frustrating when running into lag on a text editor when I'm banging out quick edits when either in the zone or working to a tight deadline. Frustrating enough that I have stopped using some text editors because of it.


If you are talking about typing, then I agree, 100ms lag after every keystroke, would be noticeable and annoying, but edits?

Surely you are not claiming to be doing 10 edits a second, where you might need to start complaining about 100ms lag?


I'm not really sure how you've interpreted my claim but the context of this discussion was about holding the text as an unbuffered array. This would mean every keystroke is effectively an edit. But even that aside, I'm sure we've all done stuff like:

    type "foobar\n" -> select "foobar\n" -> copy
    ctrl+v
    ctrl+v
    ctrl+v
    ctrl+v
    ctrl+v
...or the equivalent with replacing text within blocks of the same document; or other repetitive textual tasks that could easily be marcoed if it were a job you'd need to repeat again at a future point in time.


> A response time of 100ms is perceived as instantaneous.

please no :( my eyes hurt just from the thought of it. 10ms at most and I'm sure some people can perceive even faster stuff.


You're conflating two different things.

A typical screen refreshes at 60Hz, giving 16ms between refreshes. If you take more than 16ms between animation frames, it will appear choppy and "bad".

The 100ms budget is around pressing a button and seeing a response. If you pressed your refresh button and the page loaded in 100ms, you consider that sufficiently "instantaneous". (This breaks down for video game controls where you're continuously giving input. And maybe 100ms is too long to respond to someone typing at 70WPM, but expecting a 10ms response is much too greedy.)


Is it, though? IntelliJ, a fully-blown IDE gets below it: https://pavelfatin.com/typing-with-pleasure/

I don’t see the logic behind having a full 60fps in a 3d game but not in a textarea (even though the linked article explains why it’s difficult).


xxxdarrenxxx's dead comment is long and relevant. If you don't have them turned on, it might be worthwhile.


your eyeballs have more than 10ms latency iirc


Even if there was a minute latency between our eyes and brain, we would still be able to perceive the same sub-second differences we can now. We would just be too late to react to them.


Even if 100ms delay wasn’t noticeable, my peak writing speed is over 10 characters per second. Every character which comes less than 100ms after the previous one adds some delay, and I can imagine you end up writing for a bit, then stop and wait as the computer types 10 characters per second trying to catch up with you.


The limit probably more to do with typing speed isn't it? 100wpm, 5.1 characters per word is 8.5 characters per second.


~5ms is a more realistic budget given the 60-120 Hz refresh rate of most displays.


I take issue with the 100ms statement, but perhaps I'm missing something.

My hands automatically tend to play ahead of time when I play on a midi keyboard (piano piece) with anything more than 12ms.

Doesn't matter what I think I perceive, reality is my hands (muscle memory) intuitively perceive lag and begin to (measurably) hit notes just before the beat.

Likewise when I play a multiplayer (pvp) game, 100ms is considered even for the average gamer to be slow and annoying and is very much perceivable.

I like it no more than 25ms, and I have the luxury to get 7ms in best case scenario over fiber and ethernet. I can anticipate for the lag sure, but I feel it, which in this context is perceiving.

I am very confident I do not have to look at a gauge to perceive the lag, and can easily perceive it in a blind test around the 10 - 20ms response times.

I hit just one key and I notice if I lag or not. My ears are finetuned to expect the responding note to sound with at least 10ms accuracy within the resulting timeframe.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: