| Hi, I'm working on the editor since almost 5 years now. Phew, time flies. There is no silver bullet, we mostly try to keep all computations limited to the viewport size (if you have 20 lines visible, then typing, colorizing, painting a frame, etc. should all end up being computed with loops covering those 20 lines and not the entire buffer size). We also use extensively the profilers, and most recently (last month) I learned about this great tool called IR Hydra[1]. The gains from eliminating bailouts in the hot code paths are probably too small to notice (5-10% per render), but I like to think that everything adds up. We use translate3d for scrolling (except in Firefox which has a known bug[2]) and that brings down the browser painting times considerably when scrolling. I've also found insertAdjacentHTML to be the fastest way to create dom nodes (from big fat strings) across all browsers. Sort of silly to mention, but we use binary search a lot :). [1] http://mrale.ph/irhydra/2/ [2] https://bugzilla.mozilla.org/show_bug.cgi?id=1083132 |
[1] https://top.fse.guru/nodejs-a-quick-optimization-advice-7353...