One small stylesheet and one small script, both from your own server, sent minified, and only on pages that show a contents list. Nothing is queued on your shop, your cart or account pages, your archives, your home page, or a product or post too short to get a list.
The list is built in the same pass that writes the anchors, so finding the headings costs one scan of the content rather than a second one.
Still stuck? Ask the developers who wrote it. We aim to reply within one business day.
