Mark, this seems worth a separate thread. Would you mind opening one that
explains a couple of motivating problem scenarios, and then this proposed
solution?

On Sat, Sep 24, 2016, 5:28 PM Mark Hamburg <[email protected]> wrote:

> I wonder if the following strategy would work to address this...
>
> 1. Bring back some form of general purpose keyed identifier for virtual
> DOM nodes.
>
> 2. Before diffing two virtual DOM trees, build a map from keys to DOM
> nodes for such keyed nodes. When processing a reference to a node in the
> result, if it has a key, prefer to use the entry in this map. (Multiple
> uses of the same id need to have some logic to keep things from blowing up
> but we could reasonably lose the optimization for all but the "first" use
> of an id.)
>
> Challenges:
>
> * Will this actually work well with the real DOM or will removal and
> reinsertion cause problems?
>
> * This is essentially based on doing full scans of the tree and I assume
> there are optimizations around subtrees that haven't changed. Those
> subtrees would at least need to be scanned to continue their claim on DOM
> nodes with identifiers.
>
> But if this works, then the fix for a text node or web component getting
> its state whacked would be to give it an identifier.
>
> For lists, the new keyed support is great and probably more efficient than
> what we had before. But for creating "identity" for view nodes, it probably
> isn't what is needed and what was there before while better was not really
> fully sufficient either.
>
> Mark
>
> P.S. There is also a related problem for external components with not
> getting new components when we want them. Identifiers would fix that as
> well.
>
> P.P.S. This same work could also conceivably enable some form of DOM node
> recycling. I think I recall that being part of the set of tricks that
> Google Maps used to wow people on performance when it first launched and
> it's part of what Apple's UITableView does to get performance in native
> lists.
>
> > On Sep 24, 2016, at 8:27 AM, Richard Feldman <
> [email protected]> wrote:
> >
> > Yep, very true. I would love for there to be a better solution for text
> fields in particular.
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Elm Discuss" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected].
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Elm Discuss" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/elm-discuss/2RTddO_4rLw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to