Bonsai/virtual-dom diff an existing dom tree?

  1. Right now, bonsai / virtual-dom / incr_dom starts with a blank div.

  2. I am wondering if it is possible to have it diff an existing dom tree.

Here is the XY problem:

Even in release mode, my JS output is in the MBs, and each MB is (experimentally determined on my machine) 100ms to 150ms to load. (not to download file, but for Chrome to parse / exec).

Thus, when the page first loads, there’s a few hundred ms of wait while the JS unpacks and gets parsed and starts running.

To give the appearance of faster load time, I’d prefer to have something already loaded (via manually writing some HTML).

But then this requires the bonsai / incr_dom / virtual_dom diffs an existing dom-tree instead of creating one from scratch.

Aside: why not just throw away the existing tree when bonsai / incr_dom / virtual_dom is ready? iframes are involved and I’d prefer to not reload them

1 Like

As a sanity check, can anyone build a Bonsai app at < 900kb output ?

With --profile=release , I’m hitting 900k-1MB. I’m wondering if there is room for further improvement or if that is about the limit given the dependencies (async, virtual dom, incremental, incr_dom, bonsai itself).

That’s about the size I’ve been getting. It’s heavy, depending on your use case.