From 2cea76f20a89d3a1afd14bbbf6a591d87a59cf0a Mon Sep 17 00:00:00 2001 From: shenleban tongying Date: Sun, 24 Mar 2024 16:00:18 -0400 Subject: [PATCH] TEMP: add basic time measure to mdx --- src/dict/mdx.cc | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/dict/mdx.cc b/src/dict/mdx.cc index ba5a50766..a4834cf16 100644 --- a/src/dict/mdx.cc +++ b/src/dict/mdx.cc @@ -1270,11 +1270,13 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f string dictId = Dictionary::makeDictionaryId( dictFiles ); string indexFile = indicesDir + dictId; - - if ( Dictionary::needToRebuildIndex( dictFiles, indexFile ) || indexIsOldOrBad( dictFiles, indexFile ) ) { + int t = 20; +mdxbench: + if ( true ) { // Building the index - gdDebug( "MDict: Building the index for dictionary: %s\n", fileName.c_str() ); + // gdDebug( "MDict: Building the index for dictionary: %s\n", fileName.c_str() ); + auto index_begin = std::chrono::high_resolution_clock::now(); MdictParser parser; list< sptr< MdictParser > > mddParsers; @@ -1432,6 +1434,15 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f idx.rewind(); idx.write( &idxHeader, sizeof( idxHeader ) ); + + auto index_finish = std::chrono::high_resolution_clock::now(); + std::chrono::duration c = index_finish - index_begin; + qDebug() << c; + + t = t - 1; + if ( t > 0 ) { + goto mdxbench; + } } dictionaries.push_back( std::make_shared< MdxDictionary >( dictId, indexFile, dictFiles ) );