Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Yershov <yershov@corp.mail.ru>2015-01-13 12:57:49 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:36:08 +0300
commiteaf43ae6feedb2e4e5f59e3932968d32c8f9f965 (patch)
treee019ca7960f0e230634ca877ff230a030219aca6 /indexer/search_index_builder.cpp
parenta873972368be4f5a386ced6d671b6bed81a2164c (diff)
Optimization memory reallocation while reading variable length records
Simple optimization get_mark_value Correct working with paths in generator_tool
Diffstat (limited to 'indexer/search_index_builder.cpp')
-rw-r--r--indexer/search_index_builder.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/indexer/search_index_builder.cpp b/indexer/search_index_builder.cpp
index 5b8373e9d8..6e898e6cb6 100644
--- a/indexer/search_index_builder.cpp
+++ b/indexer/search_index_builder.cpp
@@ -396,15 +396,15 @@ void BuildSearchIndex(FilesContainerR const & cont, CategoriesHolder const & cat
}
-bool indexer::BuildSearchIndexFromDatFile(string const & fName, bool forceRebuild)
+bool indexer::BuildSearchIndexFromDatFile(string const & datFile, bool forceRebuild)
{
LOG(LINFO, ("Start building search index. Bits = ", search::POINT_CODING_BITS));
try
{
Platform & pl = GetPlatform();
- string const datFile = pl.WritablePathForFile(fName);
- string const tmpFile = pl.WritablePathForFile(fName + ".search_index_2.tmp");
+ string const tmpFile1 = datFile + ".search_index_1.tmp";
+ string const tmpFile2 = datFile + ".search_index_2.tmp";
{
FilesContainerR readCont(datFile);
@@ -412,12 +412,11 @@ bool indexer::BuildSearchIndexFromDatFile(string const & fName, bool forceRebuil
if (!forceRebuild && readCont.IsExist(SEARCH_INDEX_FILE_TAG))
return true;
- FileWriter writer(tmpFile);
+ FileWriter writer(tmpFile2);
CategoriesHolder catHolder(pl.GetReader(SEARCH_CATEGORIES_FILE_NAME));
- BuildSearchIndex(readCont, catHolder, writer,
- pl.WritablePathForFile(fName + ".search_index_1.tmp"));
+ BuildSearchIndex(readCont, catHolder, writer, tmpFile1);
LOG(LINFO, ("Search index size = ", writer.Size()));
}
@@ -426,10 +425,10 @@ bool indexer::BuildSearchIndexFromDatFile(string const & fName, bool forceRebuil
// Write to container in reversed order.
FilesContainerW writeCont(datFile, FileWriter::OP_WRITE_EXISTING);
FileWriter writer = writeCont.GetWriter(SEARCH_INDEX_FILE_TAG);
- rw_ops::Reverse(FileReader(tmpFile), writer);
+ rw_ops::Reverse(FileReader(tmpFile2), writer);
}
- FileWriter::DeleteFileX(tmpFile);
+ FileWriter::DeleteFileX(tmpFile2);
}
catch (Reader::Exception const & e)
{