improve indexing performance for LDA code