Block Nodes with Marks

Hi Marijn,

Me again :joy: We went down a rabbit hole and noticed another case where we were seeing NodeViews being recreated all the time.

After looking into it more, it occurs when there are block nodes that have a mark attached to it. It seems when this happens, the preMatch will not find a matching node as this algorithm expects a node property to be present on the ViewDesc. In the case of a MarkViewDesc this is not true. Is there a way to make the preMatch algorithm work for cases wear a block node is wrapped in a mark?

Hopefully this makes sense!

1 Like

Right, the pre-matching kind of punts on marks, since working properly for them would be quite a bit more difficult and the assumption was that big nodes will tend to be nodes with block children, and block nodes don’t have marks (which was true at the time). I just spent some time seeing if I could find a good implementation strategy for fixing this, but wasn’t able to come up with anything that didn’t involve overhauling the entire synchronization algorithm (which would be very scary). I’ll try to allocate some more time on it later this week.

That would be awesome if you could have a look into it! I believe it would have some pretty important performance benefits for us as we have quite a few marks that can wrap a block node.

This patch improves pre-matching with marks involved. Could you take a look and let me know if it helps for your use case?

2 Likes

That patch is amazing! Totally fixes our use case and the preMatch no longer misses. Keen for another release with it :smiley:

Tagged as 1.23.2.