Small optimization of kd-tree building