From f5f17e13e3014df6e4d43c156f68b2c128b46b89 Mon Sep 17 00:00:00 2001 From: zhangzihao Date: Mon, 1 Feb 2021 21:20:38 +0800 Subject: [PATCH] Set max thread count in first index equals half the number of logical processor. --- libsearch/index/index-generator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libsearch/index/index-generator.cpp b/libsearch/index/index-generator.cpp index dba2f3b..5924c0d 100644 --- a/libsearch/index/index-generator.cpp +++ b/libsearch/index/index-generator.cpp @@ -228,7 +228,7 @@ void IndexGenerator::HandlePathList(QQueue> *messageList) // future.cancel(); // m_doc_list_path = new QList(docList); QThreadPool pool; -// pool.setMaxThreadCount(1); + pool.setMaxThreadCount(((QThread::idealThreadCount() - 1) / 2) + 1); pool.setExpiryTimeout(100); ConstructDocumentForPath *constructer; while(!messageList->isEmpty()) @@ -260,7 +260,7 @@ void IndexGenerator::HandlePathList(QQueue *messageList) ChineseSegmentation::getInstance(); ConstructDocumentForContent *constructer; QThreadPool pool; -// pool.setMaxThreadCount(2); + pool.setMaxThreadCount(((QThread::idealThreadCount() - 1) / 2) + 1); pool.setExpiryTimeout(100); while(!messageList->isEmpty()) {