use a set to keep track of branches

this allows us to avoid many loops over all branches

on my repo: 7.3s -> 2.4s
use an ordered set to store children and sort them only when needed

this avoids sorting all children everytime one is added

on my repo: 2.4s -> 1.2s
cache sorted children so we only sort them when needed

without this opening the tags section is extremely slow.