buildTree performances improvement