Plugin works slow on processing selection of component with instances (weird behavior)

I don’t have an exact answer but

Check out this topic: Figma layers tree traversal + estimating size

And this thread: https://twitter.com/zyumbik/status/1356604734296236032