Fast alternative to `appendChild`

Viewed 316

Question

Is there a fast alternative to appendChild when the elements are large?

const output = parent.appendChild(child);

This single function call blocks the main thread of my app making it very slow.

Background

In the minimap-lens package for Atom, I need to append an element to the editor element. However, doing this operation is very expensive and can take ~1 min for the large editor elements (>1500 lines). I think that is because the chromium engine needs to calculate the exact size of DOM elements before doing this. It happens at this line: appendChild

    const parent = atom.views.getView(atom.workspace.getActiveTextEditor())
    const output = parent.appendChild(child)
0 Answers
Related