I recently wrote a brief overview of three interesting browser based editors. Marijn Haverbeke the author of CodeMirror mentioned that CodeMirror 2 would be much faster, and I have to say I’m impressed. CodeMirror 2 is using virtual rendering to display and format code much more quickly.
This trick is achieved by only rendering rows as they are needed. As they scroll off the top, rows are removed and and new ones are added to bottom of the scrolling element. This is becoming more common as web applications tackle larger amounts of data. I have also seen this technique used for displaying large tables of data in libraries such as SlickGrid, UkiJS, and we use a variant of this at LiquidPlanner for displaying large and complex project schedules.
CodeMirror 2 also has some interesting demos showing off code completion, search and replace, and parsing embedded languages. If any of this sounds interesting to you, I suggest you skim the manual and watch Marijn’s CodeMirror 2 repository on GitHub. It looks like it’s shaping up to be a great project.