try to make build_index faster.