Tree widget

Gervase Markham gerv at mozilla.org
Tue Mar 28 06:50:14 UTC 2017


On 28/03/17 05:23, Ben Bucksch wrote:
> There are many HTML tree widget implementations out there, but most fail
> when you start pushing 100000 entries in there. The problem is that most
> create a DOM nodes for every line and cell, and once you get to a
> million DOM nodes, that's a noticeable load time and costs RAM. For
> Thunderbird, we need to render folders with tens of thousands and a
> hundred thousand emails.

Except you don't, because one never displays that many all at one time.
Surely one could do a lazy-loading (and lazy-unloading) implementation?
We may have to keep all the folder data in memory, but that doesn't mean
it all has to be in the form of a single DOM.

> How did I do that? The basic trick is that I don't create DOM nodes for
> every rows, but only for the 10 or so visible rows. The data is in a
> pure data array. When the user scrolls, I do not move or destroy DOM
> nodes, but merely replace their text content and leave the nodes in
> place. 

Er... great minds think alike :-)

Gerv


More information about the tb-planning mailing list