I’m measuring how long it takes the code below to set attributes to nodes in bulk:
tr.doc.nodesBetween(0, tr.doc.content.size,
(node, pos) => {
tr.setNodeAttribute(pos, "foo", "bar")
return false;
}
);
For 1000 nodes, it takes ~80ms, for 2000 nodes it takes ~300ms. However, by 4000 nodes it has jumped up to ~1200ms, which is longer than ideal. Is there a faster method of setting attributes in bulk?