Try to reduce allocations in dependency construction