From ebf89d7214f9e26bf73a90b17caa6487416eeec2 Mon Sep 17 00:00:00 2001 From: Yuri Gorshenin Date: Fri, 7 Jul 2017 13:08:23 +0300 Subject: [PATCH] Review fixes. --- coding/coding_tests/text_storage_tests.cpp | 3 ++- coding/text_storage.hpp | 11 +++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/coding/coding_tests/text_storage_tests.cpp b/coding/coding_tests/text_storage_tests.cpp index 8f9f86f343..ded2e8e206 100644 --- a/coding/coding_tests/text_storage_tests.cpp +++ b/coding/coding_tests/text_storage_tests.cpp @@ -86,7 +86,8 @@ UNIT_TEST(TextStorage_Simple) UNIT_TEST(TextStorage_Empty) { vector strings; - for (int i = 0; i < 1000; ++i) { + for (int i = 0; i < 1000; ++i) + { strings.emplace_back(string(1 /* size */, i % 256)); for (int j = 0; j < 1000; ++j) strings.emplace_back(); diff --git a/coding/text_storage.hpp b/coding/text_storage.hpp index 0f0c50b9d2..ac4f7065ce 100644 --- a/coding/text_storage.hpp +++ b/coding/text_storage.hpp @@ -14,14 +14,17 @@ namespace coding { -// Writes set of strings in a format that allows to access blocks of -// strings. The size of each block roughly equals to the |blockSize|, +// Writes a set of strings in a format that allows to efficiently +// access blocks of strings. This means that access of individual +// strings may be inefficient, but access to a block of strings can be +// performed in O(length of all strings in the block + log(number of +// blocks)). The size of each block roughly equals to the |blockSize|, // because the whole number of strings is packed into a single block. // // Format description: // * first 8 bytes - little endian-encoded offset of the index section // * data section - represents a catenated sequence of BWT-compressed blocks with -// the sequence of individual string lengths in the block +// a sequence of individual string lengths in the block // * index section - represents a delta-encoded sequence of // BWT-compressed blocks offsets intermixed with the number of // strings inside each block. @@ -183,7 +186,7 @@ public: auto const numBlocks = ReadVarUint(source); m_blocks.assign(numBlocks, {}); - uint64_t prevOffset = 8; // 8 bytes for the offset + uint64_t prevOffset = 8; // 8 bytes for the offset of the data section for (uint64_t i = 0; i < numBlocks; ++i) { auto const delta = ReadVarUint(source);