Hello,
i do some heavy processing on the syntax tree, that I get from the current state of the editor. I would really appreciate if I could transfer the syntax tree to a web worker to do the processing in another thread. Unfortunately I cannot stringify the tree because of circular properties such as “parent” and “tree”.
I only need very few properties of the nodes (“from”, “to”, “name” and “nextSibling”) so I tried to write my own function a ka
function serializeNode(node){
if(!node){
return null;
}
var t={};
t.from=node.from;
t.to=node.to;
t.firstChild=serializeNode(node.firstChild);
t.name=node.name;
t.nextSibling=serializeNode(node.nextSibling);
return t;
}
Unfortunately this function is slower than the whole processing on the tree…
Is there any possibility to pass a Tree object to a web worker in a decent amount of time?