diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:17 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:17 +0300 |
commit | d3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch) | |
tree | dd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/cpp/comptable/usage/usage.cpp | |
parent | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff) | |
download | ydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/comptable/usage/usage.cpp')
-rw-r--r-- | library/cpp/comptable/usage/usage.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/library/cpp/comptable/usage/usage.cpp b/library/cpp/comptable/usage/usage.cpp index 550b6777c3..9997c83686 100644 --- a/library/cpp/comptable/usage/usage.cpp +++ b/library/cpp/comptable/usage/usage.cpp @@ -1,15 +1,15 @@ #include <library/cpp/comptable/comptable.h> -#include <util/random/random.h> -#include <util/random/fast.h> - +#include <util/random/random.h> +#include <util/random/fast.h> + #include <time.h> #include <stdlib.h> using namespace NCompTable; -template <bool HQ> -void DoTest(const TCompressorTable& table, const TVector<TString>& lines) { +template <bool HQ> +void DoTest(const TCompressorTable& table, const TVector<TString>& lines) { TVector<char> compressed; TVector<char> decompressed; @@ -19,8 +19,8 @@ void DoTest(const TCompressorTable& table, const TVector<TString>& lines) { size_t origSize = 0; size_t compSize = 0; float cl1 = clock(); - for (size_t i = 0; i < lines.size(); ++i) { - const TString& line = lines[i]; + for (size_t i = 0; i < lines.size(); ++i) { + const TString& line = lines[i]; compressor.Compress(line, &compressed); origSize += line.size(); compSize += compressed.size(); @@ -28,20 +28,20 @@ void DoTest(const TCompressorTable& table, const TVector<TString>& lines) { deCompressor.Decompress(in, &decompressed); if (decompressed.size() != line.size() || memcmp(decompressed.data(), line.data(), decompressed.size())) { Cout << i << "\n"; - Cout << line << "\n" - << TString(decompressed.data(), decompressed.size()) << "\n"; + Cout << line << "\n" + << TString(decompressed.data(), decompressed.size()) << "\n"; abort(); } } float cl2 = clock(); float secs = (cl2 - cl1) / CLOCKS_PER_SEC; Cout << "origSize: " << origSize << "\tcompSize: " << compSize << Endl; - Cout << "yep! compression + decompression speed " << origSize / 1024.0f / 1024.0f / secs << " mbps\n"; + Cout << "yep! compression + decompression speed " << origSize / 1024.0f / 1024.0f / secs << " mbps\n"; Cout << "yep! compression ratio " << double(origSize) / double(compSize + 1) << "\n"; } -int main(int argc, const char* argv[]) { - TReallyFastRng32 rr(17); +int main(int argc, const char* argv[]) { + TReallyFastRng32 rr(17); TVector<TString> lines; /*FILE *fp = fopen("res", "rb"); while (!feof(fp)) { @@ -52,16 +52,16 @@ int main(int argc, const char* argv[]) { //for (size_t i = 0; i < 10000000; ++i) { //for (size_t i = 0; i < 1000000; ++i) { for (size_t i = 0; i < 1000000; ++i) { - size_t size = rr.Uniform(32); + size_t size = rr.Uniform(32); TString res = "www.yandex.ru/yandsearch?text="; for (size_t j = 0; j < size; ++j) { - res += "qwer"[rr.Uniform(4)]; + res += "qwer"[rr.Uniform(4)]; } lines.push_back(res); } THolder<TDataSampler> sampler(new TDataSampler); for (size_t i = 0; i < lines.size(); ++i) { - sampler->AddStat(lines[i]); + sampler->AddStat(lines[i]); } TCompressorTable table; sampler->BuildTable(table); |