ok@goanna.oz.au (Richard O'keefe) (02/09/90)
sja@sirius.hut.fi (Sakari Jalovaara) writes: >> gap motion delay The only time you need to move the gap is when you want to insert or delete and the gap is in the wrong place. >One small point I haven't seen mentioned: replace-string in a gap >editor can be s...l...o...w. It can be optimized somewhat, though. Eh? The buffer gap method is one of the BEST around for search and replace, because the searching code works with a straight array of characters. Yes, when you replace, you may have to move the characters you traversed, but that gives you a cost of 3N memory references (where N is the number of characters traversed) instead of 1N or so, and the saving from using raw pointers into memory instead of going through an abstraction layer can be _huge_. I have worked on buffer-gap and piece-table editors both, and I know which one handled search-and-replace better.