Use less memory in building index; Speed up with multi-thread.