database: speed up commit building the tree manually