marijnh/CodeMirror2 — pull request #691 by jankeromnes (2012-08-03 12:51:44+00:00)
Title: Save memory on null pointers in Line object

Regarding issue #688:

I removed the explicit null pointers from the `Line` object constructor, and I benchmarked this change loading a 178K-lines file into a single CodeMirror instance. I ran Chrome 21 Linux 64 bits, and took heap snapshots in both cases with the chrome devtools heap profiler, looking at the shallow sizes.

# Before

178 K `Line` objects in memory, taking up 20 MB of heap.
279 K `(array)` objects in memory, taking up 58 MB of heap.
374 K `(string)` objects in memory, taking up 14 MB of heap.

# After

178 K `Line` objects in memory, taking up 11 MB of heap.
281 K `(array)` objects in memory, taking up 60 MB of heap.
378 K `(string)` objects in memory, taking up 14 MB of heap.

I didn't precisely measure loading time and scrolling performance in both cases, but I there is no noticeable difference.