aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authormonster <monster@ydb.tech>2022-07-07 14:41:37 +0300
committermonster <monster@ydb.tech>2022-07-07 14:41:37 +0300
commit06e5c21a835c0e923506c4ff27929f34e00761c2 (patch)
tree75efcbc6854ef9bd476eb8bf00cc5c900da436a2 /util
parent03f024c4412e3aa613bb543cf1660176320ba8f4 (diff)
downloadydb-06e5c21a835c0e923506c4ff27929f34e00761c2.tar.gz
fix ya.make
Diffstat (limited to 'util')
-rw-r--r--util/CMakeLists.txt2
-rw-r--r--util/a.yaml38
-rw-r--r--util/charset/benchmark/to_lower/main.cpp61
-rw-r--r--util/charset/benchmark/to_lower/metrics/main.py5
-rw-r--r--util/charset/benchmark/utf8_to_wide/main.cpp161
-rw-r--r--util/charset/benchmark/utf8_to_wide/metrics/main.py5
-rw-r--r--util/datetime/base.pxd126
-rw-r--r--util/datetime/strptime.cpp627
-rw-r--r--util/digest/fnv.pxd2
-rw-r--r--util/folder/dirent_win.c125
-rw-r--r--util/folder/lstat_win.c35
-rw-r--r--util/generic/benchmark/cont_speed/main.cpp117
-rw-r--r--util/generic/benchmark/fastclp2/main.cpp50
-rw-r--r--util/generic/benchmark/fastclp2/metrics/main.py5
-rw-r--r--util/generic/benchmark/log2/main.cpp140
-rw-r--r--util/generic/benchmark/log2/metrics/main.py5
-rw-r--r--util/generic/benchmark/rotate_bits/main.cpp66
-rw-r--r--util/generic/benchmark/rotate_bits/metrics/main.py5
-rw-r--r--util/generic/benchmark/singleton/f.cpp18
-rw-r--r--util/generic/benchmark/singleton/main.cpp54
-rw-r--r--util/generic/benchmark/smart_pointers/main.cpp14
-rw-r--r--util/generic/benchmark/sort/main.cpp77
-rw-r--r--util/generic/benchmark/string/benchmarks.h188
-rw-r--r--util/generic/benchmark/string/std_string.cpp8
-rw-r--r--util/generic/benchmark/string/string.cpp8
-rw-r--r--util/generic/benchmark/vector_count_ctor/f.cpp25
-rw-r--r--util/generic/benchmark/vector_count_ctor/f.h9
-rw-r--r--util/generic/benchmark/vector_count_ctor/main.cpp30
-rw-r--r--util/generic/benchmark/vector_count_ctor/metrics/main.py5
-rw-r--r--util/generic/fuzz/vector/main.cpp47
-rwxr-xr-xutil/generic/va_args_gen.py211
-rw-r--r--util/memory/benchmark/pool/main.cpp26
-rw-r--r--util/memory/benchmark/pool/metrics/main.py5
-rw-r--r--util/random/benchmark/prng/main.cpp123
-rw-r--r--util/random/benchmark/prng/metrics/main.py5
-rw-r--r--util/string/benchmark/ascii/main.cpp123
-rw-r--r--util/string/benchmark/cast/main.cpp66
-rw-r--r--util/string/benchmark/float_to_string/main.cpp253
-rw-r--r--util/string/benchmark/float_to_string/metrics/main.py5
-rw-r--r--util/string/benchmark/join/main.cpp95
-rw-r--r--util/string/benchmark/join/metrics/main.py5
-rw-r--r--util/string/benchmark/strip/main.cpp65
-rw-r--r--util/string/benchmark/subst_global/main.cpp203
-rw-r--r--util/string/benchmark/subst_global/metrics/main.py5
-rw-r--r--util/string/cast.py27
-rw-r--r--util/string/fuzzing/collapse/main.cpp12
-rw-r--r--util/string/fuzzing/escape_c/main.cpp11
-rw-r--r--util/string/fuzzing/strtod/main.cpp9
-rw-r--r--util/system/benchmark/cpu_id/main.cpp51
-rw-r--r--util/system/benchmark/cpu_id/metrics/main.py5
-rw-r--r--util/system/benchmark/create_destroy_thread/main.cpp26
-rw-r--r--util/system/benchmark/create_destroy_thread/metrics/main.py7
-rw-r--r--util/system/benchmark/rdtsc/main.cpp61
-rw-r--r--util/system/context_aarch64.S52
-rw-r--r--util/system/err.cpp80
-rw-r--r--util/system/fs_win.cpp255
-rw-r--r--util/system/fs_win_ut.cpp71
-rw-r--r--util/system/winint.cpp1
-rw-r--r--util/tests/sym_versions/test_glibc.py29
59 files changed, 1 insertions, 3944 deletions
diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt
index fc7b1ee73c..a681d385f3 100644
--- a/util/CMakeLists.txt
+++ b/util/CMakeLists.txt
@@ -8,6 +8,6 @@
if (APPLE)
include(CMakeLists.darwin.txt)
-elseif (UNIX AND NOT APPLE)
+elseif (UNIX)
include(CMakeLists.linux.txt)
endif()
diff --git a/util/a.yaml b/util/a.yaml
deleted file mode 100644
index e658783472..0000000000
--- a/util/a.yaml
+++ /dev/null
@@ -1,38 +0,0 @@
-service: cpputil
-title: "Yandex C++ util base library"
-arcanum:
- auto_merge:
- requirements:
- - system: arcanum
- type: comment_issues_closed
-ci:
- secret: sec-01fgmqmem182tz4zjsmgd6nxxw
- runtime:
- sandbox-owner: CPPUTIL
- autocheck:
- fast-targets:
- - util
- actions:
- util-style-test:
- flow: util-style-test
- triggers:
- - on: pr
- filters:
- - sub-paths: [ '**.h', '**.cpp', '**.c' ]
- - on: commit
- filters:
- - sub-paths: [ '**.h', '**.cpp', '**.c' ]
- - discovery: graph
- abs-paths: [ 'util/tests/style/ya.make' ]
- flows:
- util-style-test:
- title: "C++ style"
- jobs:
- yamake-util-tests-style:
- title: "Ya Make: util/tests/style"
- task: common/arcadia/ya_make
- input:
- targets: util/tests/style
- test: true
- keep_on: true
- check_return_code: true
diff --git a/util/charset/benchmark/to_lower/main.cpp b/util/charset/benchmark/to_lower/main.cpp
deleted file mode 100644
index e95fdc2371..0000000000
--- a/util/charset/benchmark/to_lower/main.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-#include <library/cpp/testing/benchmark/bench.h>
-
-#include <util/charset/wide.h>
-#include <util/generic/singleton.h>
-#include <util/generic/vector.h>
-#include <util/generic/string.h>
-
-static const auto ShortAscii = UTF8ToWide("hELlo");
-static const auto LongAscii = UTF8ToWide(
- "The first plane, plane 0, the Basic Multilingual Plane (BMP) contains characters for almost "
- "all modern languages, and a large number of symbols. A primary objective for the BMP is to "
- "support the unification of prior character sets as well as characters for writing. Most of "
- "the assigned code points in the BMP are used to encode Chinese, Japanese, and Korean (CJK) "
- "characters.");
-
-static const auto ShortRussian = UTF8ToWide("пРИвет");
-static const auto LongRussian = UTF8ToWide(
- "Плоскость 0 (Основная многоязычная плоскость, англ. Basic Multilingual Plane, BMP) отведена "
- "для символов практически всех современных письменностей и большого числа специальных символов. "
- "Большая часть таблицы занята китайско-японскими иероглифами и своеобразными корейскими"
- "буквами. В Юникоде 10.0 в этой плоскости представлены следующие блоки");
-
-#define DEFINE_INPLACE_BENCH(s) \
- Y_CPU_BENCHMARK(s##CopyDetach, iface) { \
- for (size_t i = 0, iEnd = iface.Iterations(); i < iEnd; ++i) { \
- NBench::Clobber(); \
- auto copy = s; \
- NBench::Escape(copy.Detach()); \
- NBench::Clobber(); \
- } \
- } \
- \
- Y_CPU_BENCHMARK(s##Inplace, iface) { \
- for (size_t i = 0, iEnd = iface.Iterations(); i < iEnd; ++i) { \
- NBench::Clobber(); \
- auto copy = s; \
- ToLower(copy); \
- NBench::Escape(copy.data()); \
- NBench::Clobber(); \
- } \
- }
-
-#define DEFINE_RET_BENCH(s) \
- Y_CPU_BENCHMARK(s##Ret, iface) { \
- for (size_t i = 0, iEnd = iface.Iterations(); i < iEnd; ++i) { \
- NBench::Clobber(); \
- const auto res = ToLowerRet(TWtringBuf{s}); \
- NBench::Escape(res.data()); \
- NBench::Clobber(); \
- } \
- }
-
-DEFINE_INPLACE_BENCH(ShortAscii)
-DEFINE_INPLACE_BENCH(LongAscii)
-DEFINE_INPLACE_BENCH(ShortRussian)
-DEFINE_INPLACE_BENCH(LongRussian)
-
-DEFINE_RET_BENCH(ShortAscii)
-DEFINE_RET_BENCH(LongAscii)
-DEFINE_RET_BENCH(ShortRussian)
-DEFINE_RET_BENCH(LongRussian)
diff --git a/util/charset/benchmark/to_lower/metrics/main.py b/util/charset/benchmark/to_lower/metrics/main.py
deleted file mode 100644
index e7495d432b..0000000000
--- a/util/charset/benchmark/to_lower/metrics/main.py
+++ /dev/null
@@ -1,5 +0,0 @@
-import yatest.common as yc
-
-
-def test_export_metrics(metrics):
- metrics.set_benchmark(yc.execute_benchmark('util/charset/benchmark/to_lower/to_lower'))
diff --git a/util/charset/benchmark/utf8_to_wide/main.cpp b/util/charset/benchmark/utf8_to_wide/main.cpp
deleted file mode 100644
index 09fa567fe5..0000000000
--- a/util/charset/benchmark/utf8_to_wide/main.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-#include <library/cpp/testing/benchmark/bench.h>
-
-#include <util/random/fast.h>
-#include <util/random/random.h>
-#include <util/generic/singleton.h>
-#include <util/generic/vector.h>
-#include <util/charset/wide.h>
-
-#include <cmath>
-
-namespace {
- template <size_t N>
- struct TRandomAsciiString: public TVector<char> {
- inline TRandomAsciiString() {
- reserve(N);
- for (size_t i = 0; i < N; ++i) {
- push_back(RandomNumber<char>(127));
- }
- }
- };
-
- template <size_t N>
- struct TRandomRuString: public TVector<char> {
- inline TRandomRuString() {
- TVector<unsigned char> data(N * 2);
- unsigned char* textEnd = data.begin();
- for (size_t i = 0; i < N; ++i) {
- size_t runeLen;
- WriteUTF8Char(RandomNumber<ui32>(0x7FF) + 1, runeLen, textEnd);
- textEnd += runeLen;
- }
- assign(reinterpret_cast<const char*>(data.begin()), reinterpret_cast<const char*>(textEnd));
- }
- };
-
- using RAS1 = TRandomAsciiString<1>;
- using RAS10 = TRandomAsciiString<10>;
- using RAS50 = TRandomAsciiString<50>;
- using RAS1000 = TRandomAsciiString<1000>;
- using RAS1000000 = TRandomAsciiString<1000000>;
-
- using RRS1 = TRandomRuString<1>;
- using RRS10 = TRandomRuString<10>;
- using RRS1000 = TRandomRuString<1000>;
- using RRS1000000 = TRandomRuString<1000000>;
-}
-
-#ifdef _sse2_
- #define IS_ASCII_BENCHMARK(length) \
- Y_CPU_BENCHMARK(IsStringASCII##length, iface) { \
- const auto& data = *Singleton<RAS##length>(); \
- for (size_t x = 0; x < iface.Iterations(); ++x) { \
- Y_DO_NOT_OPTIMIZE_AWAY(::NDetail::DoIsStringASCII(data.begin(), data.end())); \
- } \
- } \
- Y_CPU_BENCHMARK(IsStringASCIISlow##length, iface) { \
- const auto& data = *Singleton<RAS##length>(); \
- for (size_t x = 0; x < iface.Iterations(); ++x) { \
- Y_DO_NOT_OPTIMIZE_AWAY(::NDetail::DoIsStringASCIISlow(data.begin(), data.end())); \
- } \
- } \
- Y_CPU_BENCHMARK(IsStringASCIISSE##length, iface) { \
- const auto& data = *Singleton<RAS##length>(); \
- for (size_t x = 0; x < iface.Iterations(); ++x) { \
- Y_DO_NOT_OPTIMIZE_AWAY(::NDetail::DoIsStringASCIISSE(reinterpret_cast<const unsigned char*>(data.begin()), reinterpret_cast<const unsigned char*>(data.end()))); \
- } \
- }
-#else //no sse
- #define IS_ASCII_BENCHMARK(length) \
- Y_CPU_BENCHMARK(IsStringASCIIScalar##length, iface) { \
- const auto& data = *Singleton<RAS##length>(); \
- for (size_t x = 0; x < iface.Iterations(); ++x) { \
- Y_DO_NOT_OPTIMIZE_AWAY(::NDetail::DoIsStringASCII(data.begin(), data.end())); \
- } \
- } \
- Y_CPU_BENCHMARK(IsStringASCIISlow##length, iface) { \
- const auto& data = *Singleton<RAS##length>(); \
- for (size_t x = 0; x < iface.Iterations(); ++x) { \
- Y_DO_NOT_OPTIMIZE_AWAY(::NDetail::DoIsStringASCIISlow(data.begin(), data.end())); \
- } \
- }
-#endif
-
-IS_ASCII_BENCHMARK(1);
-IS_ASCII_BENCHMARK(10);
-IS_ASCII_BENCHMARK(50);
-IS_ASCII_BENCHMARK(1000);
-IS_ASCII_BENCHMARK(1000000);
-
-template <bool robust, typename TCharType>
-inline size_t UTF8ToWideImplScalar(const char* text, size_t len, TCharType* dest, size_t& written) {
- const unsigned char* cur = reinterpret_cast<const unsigned char*>(text);
- const unsigned char* last = cur + len;
- TCharType* p = dest;
-
- ::NDetail::UTF8ToWideImplScalar<robust>(cur, last, p);
- written = p - dest;
- return cur - reinterpret_cast<const unsigned char*>(text);
-}
-
-template <bool robust, typename TCharType>
-inline size_t UTF8ToWideImplSSE(const char* text, size_t len, TCharType* dest, size_t& written) {
- return UTF8ToWideImpl(text, len, dest, written);
-}
-
-static wchar16 WBUF_UTF16[10000000];
-static wchar32 WBUF_UTF32[10000000];
-
-#define UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(impl, length, to) \
- Y_CPU_BENCHMARK(UTF8ToWideASCII##impl##length##to, iface) { \
- const auto& data = *Singleton<RAS##length>(); \
- for (size_t x = 0; x < iface.Iterations(); ++x) { \
- size_t written = 0; \
- Y_DO_NOT_OPTIMIZE_AWAY(UTF8ToWideImpl##impl<false>(data.begin(), data.size(), WBUF_##to, written)); \
- } \
- }
-
-#define UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(impl, length, to) \
- Y_CPU_BENCHMARK(UTF8ToWideRU##impl##length##to, iface) { \
- const auto& data = *Singleton<RRS##length>(); \
- for (size_t x = 0; x < iface.Iterations(); ++x) { \
- size_t written = 0; \
- Y_DO_NOT_OPTIMIZE_AWAY(UTF8ToWideImpl##impl<false>(data.begin(), data.size(), WBUF_##to, written)); \
- } \
- }
-
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(Scalar, 1, UTF16);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(SSE, 1, UTF16);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(Scalar, 10, UTF16);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(SSE, 10, UTF16);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(Scalar, 1000, UTF16);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(SSE, 1000, UTF16);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(Scalar, 1000000, UTF16);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(SSE, 1000000, UTF16);
-
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(Scalar, 1, UTF16);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(SSE, 1, UTF16);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(Scalar, 10, UTF16);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(SSE, 10, UTF16);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(Scalar, 1000, UTF16);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(SSE, 1000, UTF16);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(Scalar, 1000000, UTF16);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(SSE, 1000000, UTF16);
-
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(Scalar, 1, UTF32);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(SSE, 1, UTF32);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(Scalar, 10, UTF32);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(SSE, 10, UTF32);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(Scalar, 1000, UTF32);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(SSE, 1000, UTF32);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(Scalar, 1000000, UTF32);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(SSE, 1000000, UTF32);
-
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(Scalar, 1, UTF32);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(SSE, 1, UTF32);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(Scalar, 10, UTF32);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(SSE, 10, UTF32);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(Scalar, 1000, UTF32);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(SSE, 1000, UTF32);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(Scalar, 1000000, UTF32);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(SSE, 1000000, UTF32);
diff --git a/util/charset/benchmark/utf8_to_wide/metrics/main.py b/util/charset/benchmark/utf8_to_wide/metrics/main.py
deleted file mode 100644
index ffbd8f68fd..0000000000
--- a/util/charset/benchmark/utf8_to_wide/metrics/main.py
+++ /dev/null
@@ -1,5 +0,0 @@
-import yatest.common as yc
-
-
-def test_export_metrics(metrics):
- metrics.set_benchmark(yc.execute_benchmark('util/charset/benchmark/utf8_to_wide/utf8_to_wide'))
diff --git a/util/datetime/base.pxd b/util/datetime/base.pxd
deleted file mode 100644
index 1d863b1bd8..0000000000
--- a/util/datetime/base.pxd
+++ /dev/null
@@ -1,126 +0,0 @@
-from libc.stdint cimport uint32_t
-from libc.stdint cimport uint64_t
-from libcpp cimport bool as bool_t
-from posix.types cimport time_t
-
-from util.generic.string cimport TString, TStringBuf
-
-
-cdef extern from "<util/datetime/base.h>" nogil:
-
- cdef cppclass TTimeBase:
- TTimeBase()
- TTimeBase(uint64_t)
-
- uint64_t GetValue()
- double SecondsFloat()
- uint64_t MicroSeconds()
- uint64_t MilliSeconds()
- uint64_t Seconds()
- uint64_t Minutes()
- uint64_t Hours()
- uint64_t Days()
- uint64_t NanoSeconds()
- uint32_t MicroSecondsOfSecond()
- uint32_t MilliSecondsOfSecond()
- uint32_t NanoSecondsOfSecond()
-
-
- cdef cppclass TInstant(TTimeBase):
- TInstant()
- TInstant(uint64_t)
-
- @staticmethod
- TInstant Now() except +
- @staticmethod
- TInstant Max()
- @staticmethod
- TInstant Zero()
- @staticmethod
- TInstant MicroSeconds(uint64_t)
- @staticmethod
- TInstant MilliSeconds(uint64_t)
- @staticmethod
- TInstant Seconds(uint64_t)
- @staticmethod
- TInstant Minutes(uint64_t)
- @staticmethod
- TInstant Hours(uint64_t)
- @staticmethod
- TInstant Days(uint64_t)
-
- time_t TimeT()
-
- TString ToString() except +
- TString ToStringUpToSeconds() except +
- TString ToStringLocal() except +
- TString ToStringLocalUpToSeconds() except +
- TString FormatLocalTime(const char*)
- TString FormatGmTime(const char* format)
-
- @staticmethod
- TInstant ParseIso8601(const TStringBuf) except +
- @staticmethod
- TInstant ParseRfc822(const TStringBuf) except +
- @staticmethod
- TInstant ParseHttp(const TStringBuf) except +
- @staticmethod
- TInstant ParseX509Validity(const TStringBuf) except +
-
- @staticmethod
- bool_t TryParseIso8601(const TStringBuf, TInstant&) except +
- @staticmethod
- bool_t TryParseRfc822(const TStringBuf, TInstant&) except +
- @staticmethod
- bool_t TryParseHttp(const TStringBuf, TInstant&) except +
- @staticmethod
- bool_t TryParseX509(const TStringBuf, TInstant&) except +
-
- @staticmethod
- TInstant ParseIso8601Deprecated(const TStringBuf) except +
- @staticmethod
- TInstant ParseRfc822Deprecated(const TStringBuf) except +
- @staticmethod
- TInstant ParseHttpDeprecated(const TStringBuf) except +
- @staticmethod
- TInstant ParseX509ValidityDeprecated(const TStringBuf) except +
-
- @staticmethod
- bool_t TryParseIso8601Deprecated(const TStringBuf, TInstant&) except +
- @staticmethod
- bool_t TryParseRfc822Deprecated(const TStringBuf, TInstant&) except +
- @staticmethod
- bool_t TryParseHttpDeprecated(const TStringBuf, TInstant&) except +
- @staticmethod
- bool_t TryParseX509Deprecated(const TStringBuf, TInstant&) except +
-
-
- cdef cppclass TDuration(TTimeBase):
- TDuration()
- TDuration(uint64_t)
-
- @staticmethod
- TDuration MicroSeconds(uint64_t)
-
- TInstant ToDeadLine() except +
- TInstant ToDeadLine(TInstant) except +
-
- @staticmethod
- TDuration Max()
- @staticmethod
- TDuration Zero()
- @staticmethod
- TDuration Seconds(uint64_t)
- @staticmethod
- TDuration Minutes(uint64_t)
- @staticmethod
- TDuration Hours(uint64_t)
- @staticmethod
- TDuration Days(uint64_t)
-
- @staticmethod
- TDuration Parse(const TStringBuf)
- @staticmethod
- bool_t TryParse(const TStringBuf, TDuration&)
-
- TString ToString() except +
diff --git a/util/datetime/strptime.cpp b/util/datetime/strptime.cpp
deleted file mode 100644
index f0d4ec333e..0000000000
--- a/util/datetime/strptime.cpp
+++ /dev/null
@@ -1,627 +0,0 @@
-// ATTN! this is port of FreeBSD LIBC code to Win32 - just for convenience.
-// Locale is ignored!!!
-
-/*
- * Powerdog Industries kindly requests feedback from anyone modifying
- * this function:
- *
- * Date: Thu, 05 Jun 1997 23:17:17 -0400
- * From: Kevin Ruddy <kevin.ruddy@powerdog.com>
- * To: James FitzGibbon <james@nexis.net>
- * Subject: Re: Use of your strptime(3) code (fwd)
- *
- * The reason for the "no mod" clause was so that modifications would
- * come back and we could integrate them and reissue so that a wider
- * audience could use it (thereby spreading the wealth). This has
- * made it possible to get strptime to work on many operating systems.
- * I'm not sure why that's "plain unacceptable" to the FreeBSD team.
- *
- * Anyway, you can change it to "with or without modification" as
- * you see fit. Enjoy.
- *
- * Kevin Ruddy
- * Powerdog Industries, Inc.
- */
-/*
- * Copyright (c) 1994 Powerdog Industries. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgement:
- * This product includes software developed by Powerdog Industries.
- * 4. The name of Powerdog Industries may not be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY POWERDOG INDUSTRIES ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE POWERDOG INDUSTRIES BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <util/system/compat.h>
-#include "systime.h"
-#ifdef _win32_
- #ifndef lint
- #ifndef NOID
-static char copyright[] =
- "@(#) Copyright (c) 1994 Powerdog Industries. All rights reserved.";
-static char sccsid[] = "@(#)strptime.c 0.1 (Powerdog) 94/03/27";
- #endif /* !defined NOID */
- #endif /* not lint */
- //__FBSDID("$FreeBSD: src/lib/libc/stdtime/strptime.c,v 1.35 2003/11/17 04:19:15 nectar Exp $");
-
- //#include "namespace.h"
- #include <time.h>
- #include <ctype.h>
- #include <errno.h>
- #include <stdlib.h>
- #include <string.h>
-//#include <pthread.h>
-//#include "un-namespace.h"
-//#include "libc_private.h"
-
-// ******************* #include "timelocal.h" *********************
-struct lc_time_T {
- const char* mon[12];
- const char* month[12];
- const char* wday[7];
- const char* weekday[7];
- const char* X_fmt;
- const char* x_fmt;
- const char* c_fmt;
- const char* am;
- const char* pm;
- const char* date_fmt;
- const char* alt_month[12];
- const char* md_order;
- const char* ampm_fmt;
-};
-
-// ******************* timelocal.c ******************
-/*-
- * Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org>
- * Copyright (c) 1997 FreeBSD Inc.
- * All rights reserved.
-*/
-static const struct lc_time_T _C_time_locale = {
- {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"},
- {"January", "February", "March", "April", "May", "June",
- "July", "August", "September", "October", "November", "December"},
- {"Sun", "Mon", "Tue", "Wed",
- "Thu", "Fri", "Sat"},
- {"Sunday", "Monday", "Tuesday", "Wednesday",
- "Thursday", "Friday", "Saturday"},
-
- /* X_fmt */
- "%H:%M:%S",
-
- /*
- * x_fmt
- * Since the C language standard calls for
- * "date, using locale's date format," anything goes.
- * Using just numbers (as here) makes Quakers happier;
- * it's also compatible with SVR4.
- */
- "%m/%d/%y",
-
- /*
- * c_fmt
- */
- "%a %b %e %H:%M:%S %Y",
-
- /* am */
- "AM",
-
- /* pm */
- "PM",
-
- /* date_fmt */
- "%a %b %e %H:%M:%S %Z %Y",
-
- /* alt_month
- * Standalone months forms for %OB
- */
- {
- "January", "February", "March", "April", "May", "June",
- "July", "August", "September", "October", "November", "December"},
-
- /* md_order
- * Month / day order in dates
- */
- "md",
-
- /* ampm_fmt
- * To determine 12-hour clock format time (empty, if N/A)
- */
- "%I:%M:%S %p"};
-
-struct lc_time_T*
-__get_current_time_locale(void)
-{
- return /*(_time_using_locale
- ? &_time_locale
- :*/
- (struct lc_time_T*)&_C_time_locale /*)*/;
-}
-
-// ******************* strptime.c *******************
-static char* _strptime(const char*, const char*, struct tm*, int*);
-
- #define asizeof(a) (sizeof(a) / sizeof((a)[0]))
-
- #if defined(_MSC_VER) && (_MSC_VER >= 1900)
- #define tzname _tzname
- #endif
-
-static char*
-_strptime(const char* buf, const char* fmt, struct tm* tm, int* GMTp)
-{
- char c;
- const char* ptr;
- int i;
- size_t len = 0;
- int Ealternative, Oalternative;
- struct lc_time_T* tptr = __get_current_time_locale();
-
- ptr = fmt;
- while (*ptr != 0) {
- if (*buf == 0)
- break;
-
- c = *ptr++;
-
- if (c != '%') {
- if (isspace((unsigned char)c))
- while (*buf != 0 && isspace((unsigned char)*buf))
- ++buf;
- else if (c != *buf++)
- return 0;
- continue;
- }
-
- Ealternative = 0;
- Oalternative = 0;
- label:
- c = *ptr++;
- switch (c) {
- case 0:
- case '%':
- if (*buf++ != '%')
- return 0;
- break;
-
- case '+':
- buf = _strptime(buf, tptr->date_fmt, tm, GMTp);
- if (buf == 0)
- return 0;
- break;
-
- case 'C':
- if (!isdigit((unsigned char)*buf))
- return 0;
-
- /* XXX This will break for 3-digit centuries. */
- len = 2;
- for (i = 0; len && *buf != 0 && isdigit((unsigned char)*buf); buf++) {
- i *= 10;
- i += *buf - '0';
- --len;
- }
- if (i < 19)
- return 0;
-
- tm->tm_year = i * 100 - 1900;
- break;
-
- case 'c':
- buf = _strptime(buf, tptr->c_fmt, tm, GMTp);
- if (buf == 0)
- return 0;
- break;
-
- case 'D':
- buf = _strptime(buf, "%m/%d/%y", tm, GMTp);
- if (buf == 0)
- return 0;
- break;
-
- case 'E':
- if (Ealternative || Oalternative)
- break;
- ++Ealternative;
- goto label;
-
- case 'O':
- if (Ealternative || Oalternative)
- break;
- ++Oalternative;
- goto label;
-
- case 'F':
- buf = _strptime(buf, "%Y-%m-%d", tm, GMTp);
- if (buf == 0)
- return 0;
- break;
-
- case 'R':
- buf = _strptime(buf, "%H:%M", tm, GMTp);
- if (buf == 0)
- return 0;
- break;
-
- case 'r':
- buf = _strptime(buf, tptr->ampm_fmt, tm, GMTp);
- if (buf == 0)
- return 0;
- break;
-
- case 'T':
- buf = _strptime(buf, "%H:%M:%S", tm, GMTp);
- if (buf == 0)
- return 0;
- break;
-
- case 'X':
- buf = _strptime(buf, tptr->X_fmt, tm, GMTp);
- if (buf == 0)
- return 0;
- break;
-
- case 'x':
- buf = _strptime(buf, tptr->x_fmt, tm, GMTp);
- if (buf == 0)
- return 0;
- break;
-
- case 'j':
- if (!isdigit((unsigned char)*buf))
- return 0;
-
- len = 3;
- for (i = 0; len && *buf != 0 && isdigit((unsigned char)*buf); buf++) {
- i *= 10;
- i += *buf - '0';
- --len;
- }
- if (i < 1 || i > 366)
- return 0;
-
- tm->tm_yday = i - 1;
- break;
-
- case 'M':
- case 'S':
- if (*buf == 0 || isspace((unsigned char)*buf))
- break;
-
- if (!isdigit((unsigned char)*buf))
- return 0;
-
- len = 2;
- for (i = 0; len && *buf != 0 && isdigit((unsigned char)*buf); buf++) {
- i *= 10;
- i += *buf - '0';
- --len;
- }
-
- if (c == 'M') {
- if (i > 59)
- return 0;
- tm->tm_min = i;
- } else {
- if (i > 60)
- return 0;
- tm->tm_sec = i;
- }
-
- if (*buf != 0 && isspace((unsigned char)*buf))
- while (*ptr != 0 && !isspace((unsigned char)*ptr))
- ++ptr;
- break;
-
- case 'H':
- case 'I':
- case 'k':
- case 'l':
- /*
- * Of these, %l is the only specifier explicitly
- * documented as not being zero-padded. However,
- * there is no harm in allowing zero-padding.
- *
- * XXX The %l specifier may gobble one too many
- * digits if used incorrectly.
- */
- if (!isdigit((unsigned char)*buf))
- return 0;
-
- len = 2;
- for (i = 0; len && *buf != 0 && isdigit((unsigned char)*buf); buf++) {
- i *= 10;
- i += *buf - '0';
- --len;
- }
- if (c == 'H' || c == 'k') {
- if (i > 23)
- return 0;
- } else if (i > 12)
- return 0;
-
- tm->tm_hour = i;
-
- if (*buf != 0 && isspace((unsigned char)*buf))
- while (*ptr != 0 && !isspace((unsigned char)*ptr))
- ++ptr;
- break;
-
- case 'p':
- /*
- * XXX This is bogus if parsed before hour-related
- * specifiers.
- */
- len = strlen(tptr->am);
- if (strnicmp(buf, tptr->am, len) == 0) {
- if (tm->tm_hour > 12)
- return 0;
- if (tm->tm_hour == 12)
- tm->tm_hour = 0;
- buf += len;
- break;
- }
-
- len = strlen(tptr->pm);
- if (strnicmp(buf, tptr->pm, len) == 0) {
- if (tm->tm_hour > 12)
- return 0;
- if (tm->tm_hour != 12)
- tm->tm_hour += 12;
- buf += len;
- break;
- }
-
- return 0;
-
- case 'A':
- case 'a':
- for (i = 0; i < asizeof(tptr->weekday); i++) {
- len = strlen(tptr->weekday[i]);
- if (strnicmp(buf, tptr->weekday[i],
- len) == 0)
- break;
- len = strlen(tptr->wday[i]);
- if (strnicmp(buf, tptr->wday[i],
- len) == 0)
- break;
- }
- if (i == asizeof(tptr->weekday))
- return 0;
-
- tm->tm_wday = i;
- buf += len;
- break;
-
- case 'U':
- case 'W':
- /*
- * XXX This is bogus, as we can not assume any valid
- * information present in the tm structure at this
- * point to calculate a real value, so just check the
- * range for now.
- */
- if (!isdigit((unsigned char)*buf))
- return 0;
-
- len = 2;
- for (i = 0; len && *buf != 0 && isdigit((unsigned char)*buf); buf++) {
- i *= 10;
- i += *buf - '0';
- --len;
- }
- if (i > 53)
- return 0;
-
- if (*buf != 0 && isspace((unsigned char)*buf))
- while (*ptr != 0 && !isspace((unsigned char)*ptr))
- ++ptr;
- break;
-
- case 'w':
- if (!isdigit((unsigned char)*buf))
- return 0;
-
- i = *buf - '0';
- if (i > 6)
- return 0;
-
- tm->tm_wday = i;
-
- if (*buf != 0 && isspace((unsigned char)*buf))
- while (*ptr != 0 && !isspace((unsigned char)*ptr))
- ++ptr;
- break;
-
- case 'd':
- case 'e':
- /*
- * The %e specifier is explicitly documented as not
- * being zero-padded but there is no harm in allowing
- * such padding.
- *
- * XXX The %e specifier may gobble one too many
- * digits if used incorrectly.
- */
- if (!isdigit((unsigned char)*buf))
- return 0;
-
- len = 2;
- for (i = 0; len && *buf != 0 && isdigit((unsigned char)*buf); buf++) {
- i *= 10;
- i += *buf - '0';
- --len;
- }
- if (i > 31)
- return 0;
-
- tm->tm_mday = i;
-
- if (*buf != 0 && isspace((unsigned char)*buf))
- while (*ptr != 0 && !isspace((unsigned char)*ptr))
- ++ptr;
- break;
-
- case 'B':
- case 'b':
- case 'h':
- for (i = 0; i < asizeof(tptr->month); i++) {
- if (Oalternative) {
- if (c == 'B') {
- len = strlen(tptr->alt_month[i]);
- if (strnicmp(buf,
- tptr->alt_month[i],
- len) == 0)
- break;
- }
- } else {
- len = strlen(tptr->month[i]);
- if (strnicmp(buf, tptr->month[i],
- len) == 0)
- break;
- len = strlen(tptr->mon[i]);
- if (strnicmp(buf, tptr->mon[i],
- len) == 0)
- break;
- }
- }
- if (i == asizeof(tptr->month))
- return 0;
-
- tm->tm_mon = i;
- buf += len;
- break;
-
- case 'm':
- if (!isdigit((unsigned char)*buf))
- return 0;
-
- len = 2;
- for (i = 0; len && *buf != 0 && isdigit((unsigned char)*buf); buf++) {
- i *= 10;
- i += *buf - '0';
- --len;
- }
- if (i < 1 || i > 12)
- return 0;
-
- tm->tm_mon = i - 1;
-
- if (*buf != 0 && isspace((unsigned char)*buf))
- while (*ptr != 0 && !isspace((unsigned char)*ptr))
- ++ptr;
- break;
-
- case 's': {
- char* cp;
- int sverrno;
- long n;
- time_t t;
-
- sverrno = errno;
- errno = 0;
- n = strtol(buf, &cp, 10);
- if (errno == ERANGE || (long)(t = n) != n) {
- errno = sverrno;
- return 0;
- }
- errno = sverrno;
- buf = cp;
- GmTimeR(&t, tm);
- *GMTp = 1;
- } break;
-
- case 'Y':
- case 'y':
- if (*buf == 0 || isspace((unsigned char)*buf))
- break;
-
- if (!isdigit((unsigned char)*buf))
- return 0;
-
- len = (c == 'Y') ? 4 : 2;
- for (i = 0; len && *buf != 0 && isdigit((unsigned char)*buf); buf++) {
- i *= 10;
- i += *buf - '0';
- --len;
- }
- if (c == 'Y')
- i -= 1900;
- if (c == 'y' && i < 69)
- i += 100;
- if (i < 0)
- return 0;
-
- tm->tm_year = i;
-
- if (*buf != 0 && isspace((unsigned char)*buf))
- while (*ptr != 0 && !isspace((unsigned char)*ptr))
- ++ptr;
- break;
-
- case 'Z': {
- const char* cp;
- char* zonestr;
-
- for (cp = buf; *cp && isupper((unsigned char)*cp); ++cp) { /*empty*/
- }
- if (cp - buf) {
- zonestr = (char*)alloca(cp - buf + 1);
- strncpy(zonestr, buf, cp - buf);
- zonestr[cp - buf] = '\0';
- tzset();
- if (0 == strcmp(zonestr, "GMT")) {
- *GMTp = 1;
- } else if (0 == strcmp(zonestr, tzname[0])) {
- tm->tm_isdst = 0;
- } else if (0 == strcmp(zonestr, tzname[1])) {
- tm->tm_isdst = 1;
- } else {
- return 0;
- }
- buf += cp - buf;
- }
- } break;
- }
- }
- return (char*)buf;
-}
-
-char* strptime(const char* buf, const char* fmt, struct tm* tm)
-{
- char* ret;
- int gmt;
-
- gmt = 0;
- ret = _strptime(buf, fmt, tm, &gmt);
- if (ret && gmt) {
- time_t t = timegm(tm);
- localtime_r(&t, tm);
- }
-
- return (ret);
-}
-#endif //_win32_
diff --git a/util/digest/fnv.pxd b/util/digest/fnv.pxd
deleted file mode 100644
index 92396cf4d3..0000000000
--- a/util/digest/fnv.pxd
+++ /dev/null
@@ -1,2 +0,0 @@
-cdef extern from "util/digest/fnv.h":
- T FnvHash[T](const char* buf, size_t len) nogil
diff --git a/util/folder/dirent_win.c b/util/folder/dirent_win.c
deleted file mode 100644
index 7e6db74ce5..0000000000
--- a/util/folder/dirent_win.c
+++ /dev/null
@@ -1,125 +0,0 @@
-#include <util/system/defaults.h>
-
-#ifdef _win_
-
- #include <stdio.h>
- #include "dirent_win.h"
-
- #if defined(_MSC_VER) && (_MSC_VER < 1900)
-void __cdecl _dosmaperr(unsigned long);
-
-static void SetErrno() {
- _dosmaperr(GetLastError());
-}
- #else
-void __cdecl __acrt_errno_map_os_error(unsigned long const oserrno);
-
-static void SetErrno() {
- __acrt_errno_map_os_error(GetLastError());
-}
- #endif
-
-struct DIR* opendir(const char* dirname) {
- struct DIR* dir = (struct DIR*)malloc(sizeof(struct DIR));
- if (!dir) {
- return NULL;
- }
- dir->sh = INVALID_HANDLE_VALUE;
- dir->fff_templ = NULL;
- dir->file_no = 0;
- dir->readdir_buf = NULL;
-
- int len = strlen(dirname);
- //Remove trailing slashes
- while (len && (dirname[len - 1] == '\\' || dirname[len - 1] == '/')) {
- --len;
- }
- int len_converted = MultiByteToWideChar(CP_UTF8, 0, dirname, len, 0, 0);
- if (len_converted == 0) {
- closedir(dir);
- return NULL;
- }
- dir->fff_templ = (WCHAR*)malloc((len_converted + 5) * sizeof(WCHAR));
- if (!dir->fff_templ) {
- closedir(dir);
- return NULL;
- }
- MultiByteToWideChar(CP_UTF8, 0, dirname, len, dir->fff_templ, len_converted);
-
- WCHAR append[] = {'\\', '*', '.', '*', 0};
- memcpy(dir->fff_templ + len_converted, append, sizeof(append));
- dir->sh = FindFirstFileW(dir->fff_templ, &dir->wfd);
- if (dir->sh == INVALID_HANDLE_VALUE) {
- SetErrno();
- closedir(dir);
- return NULL;
- }
-
- return dir;
-}
-
-int closedir(struct DIR* dir) {
- if (dir->sh != INVALID_HANDLE_VALUE)
- FindClose(dir->sh);
- free(dir->fff_templ);
- free(dir->readdir_buf);
- free(dir);
- return 0;
-}
-
-int readdir_r(struct DIR* dir, struct dirent* entry, struct dirent** result) {
- if (!FindNextFileW(dir->sh, &dir->wfd)) {
- int err = GetLastError();
- *result = 0;
- if (err == ERROR_NO_MORE_FILES) {
- SetLastError(0);
- return 0;
- } else {
- return err;
- }
- }
- entry->d_fileno = dir->file_no++;
- entry->d_reclen = sizeof(struct dirent);
- if (dir->wfd.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT &&
- (dir->wfd.dwReserved0 == IO_REPARSE_TAG_MOUNT_POINT || dir->wfd.dwReserved0 == IO_REPARSE_TAG_SYMLINK))
- {
- entry->d_type = DT_LNK;
- } else if (dir->wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
- entry->d_type = DT_DIR;
- } else {
- entry->d_type = DT_REG;
- }
- int len = lstrlenW(dir->wfd.cFileName);
- int conv_len = WideCharToMultiByte(CP_UTF8, 0, dir->wfd.cFileName, len, 0, 0, 0, 0);
- if (conv_len == 0) {
- return -1;
- }
- if (conv_len > sizeof(entry->d_name) - 1) {
- SetLastError(ERROR_INSUFFICIENT_BUFFER);
- return ERROR_INSUFFICIENT_BUFFER;
- }
- entry->d_namlen = conv_len;
- WideCharToMultiByte(CP_UTF8, 0, dir->wfd.cFileName, len, entry->d_name, conv_len, 0, 0);
- entry->d_name[conv_len] = 0;
- *result = entry;
- return 0;
-}
-
-struct dirent* readdir(struct DIR* dir) {
- struct dirent* res;
- if (!dir->readdir_buf) {
- dir->readdir_buf = (struct dirent*)malloc(sizeof(struct dirent));
- if (dir->readdir_buf == 0)
- return 0;
- }
- readdir_r(dir, dir->readdir_buf, &res);
- return res;
-}
-
-void rewinddir(struct DIR* dir) {
- FindClose(dir->sh);
- dir->sh = FindFirstFileW(dir->fff_templ, &dir->wfd);
- dir->file_no = 0;
-}
-
-#endif //_win_
diff --git a/util/folder/lstat_win.c b/util/folder/lstat_win.c
deleted file mode 100644
index cf94cec01a..0000000000
--- a/util/folder/lstat_win.c
+++ /dev/null
@@ -1,35 +0,0 @@
-#include <util/system/defaults.h>
-
-#ifdef _win_
- #include <util/system/winint.h>
- #include "lstat_win.h"
-
-int lstat(const char* fileName, stat_struct* fileStat) {
- int len = strlen(fileName);
- int convRes = MultiByteToWideChar(CP_UTF8, 0, fileName, len, 0, 0);
- if (convRes == 0) {
- return -1;
- }
- WCHAR* buf = malloc(sizeof(WCHAR) * (convRes + 1));
- MultiByteToWideChar(CP_UTF8, 0, fileName, len, buf, convRes);
- buf[convRes] = 0;
-
- HANDLE findHandle;
- WIN32_FIND_DATAW findBuf;
- int result;
- result = _wstat64(buf, fileStat);
- if (result == 0) {
- SetLastError(0);
- findHandle = FindFirstFileW(buf, &findBuf);
- if (findBuf.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT &&
- (findBuf.dwReserved0 == IO_REPARSE_TAG_MOUNT_POINT || findBuf.dwReserved0 == IO_REPARSE_TAG_SYMLINK))
- {
- fileStat->st_mode = fileStat->st_mode & ~_S_IFMT | _S_IFLNK;
- }
- FindClose(findHandle);
- }
- free(buf);
- return result;
-}
-
-#endif //_win_
diff --git a/util/generic/benchmark/cont_speed/main.cpp b/util/generic/benchmark/cont_speed/main.cpp
deleted file mode 100644
index 01428c9974..0000000000
--- a/util/generic/benchmark/cont_speed/main.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-#include <library/cpp/testing/benchmark/bench.h>
-
-#include <util/generic/xrange.h>
-#include <util/generic/string.h>
-#include <util/generic/vector.h>
-#include <util/generic/buffer.h>
-
-template <class C>
-Y_NO_INLINE void Run(const C& c) {
- for (size_t i = 0; i < c.size(); ++i) {
- Y_DO_NOT_OPTIMIZE_AWAY(c[i]);
- }
-}
-
-template <class C>
-void Do(size_t len, auto& iface) {
- C c(len, 0);
-
- for (auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- Run(c);
- }
-}
-
-Y_CPU_BENCHMARK(TVector10, iface) {
- Do<TVector<char>>(10, iface);
-}
-
-Y_CPU_BENCHMARK(TVector100, iface) {
- Do<TVector<char>>(100, iface);
-}
-
-Y_CPU_BENCHMARK(TVector1000, iface) {
- Do<TVector<char>>(1000, iface);
-}
-
-Y_CPU_BENCHMARK(TString10, iface) {
- Do<TString>(10, iface);
-}
-
-Y_CPU_BENCHMARK(TString100, iface) {
- Do<TString>(100, iface);
-}
-
-Y_CPU_BENCHMARK(TString1000, iface) {
- Do<TString>(1000, iface);
-}
-
-Y_CPU_BENCHMARK(StdString10, iface) {
- Do<std::string>(10, iface);
-}
-
-Y_CPU_BENCHMARK(StdString100, iface) {
- Do<std::string>(100, iface);
-}
-
-Y_CPU_BENCHMARK(StdString1000, iface) {
- Do<std::string>(1000, iface);
-}
-
-struct TBuf: public TBuffer {
- TBuf(size_t len, char v) {
- for (size_t i = 0; i < len; ++i) {
- Append(v);
- }
- }
-
- inline const auto& operator[](size_t i) const noexcept {
- return *(data() + i);
- }
-};
-
-Y_CPU_BENCHMARK(TBuffer10, iface) {
- Do<TBuf>(10, iface);
-}
-
-Y_CPU_BENCHMARK(TBuffer100, iface) {
- Do<TBuf>(100, iface);
-}
-
-Y_CPU_BENCHMARK(TBuffer1000, iface) {
- Do<TBuf>(1000, iface);
-}
-
-struct TArr {
- inline TArr(size_t len, char ch)
- : A(new char[len])
- , L(len)
- {
- for (size_t i = 0; i < L; ++i) {
- A[i] = ch;
- }
- }
-
- inline const auto& operator[](size_t i) const noexcept {
- return A[i];
- }
-
- inline size_t size() const noexcept {
- return L;
- }
-
- char* A;
- size_t L;
-};
-
-Y_CPU_BENCHMARK(Pointer10, iface) {
- Do<TArr>(10, iface);
-}
-
-Y_CPU_BENCHMARK(Pointer100, iface) {
- Do<TArr>(100, iface);
-}
-
-Y_CPU_BENCHMARK(Pointer1000, iface) {
- Do<TArr>(1000, iface);
-}
diff --git a/util/generic/benchmark/fastclp2/main.cpp b/util/generic/benchmark/fastclp2/main.cpp
deleted file mode 100644
index 49277db077..0000000000
--- a/util/generic/benchmark/fastclp2/main.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-#include <library/cpp/testing/benchmark/bench.h>
-
-#include <util/generic/bitops.h>
-#include <util/generic/vector.h>
-#include <util/generic/xrange.h>
-#include <util/generic/singleton.h>
-
-#include <util/random/fast.h>
-
-namespace {
- template <typename T, size_t N>
- struct TExamplesHolder {
- TExamplesHolder()
- : Examples(N)
- {
- TFastRng<ui64> prng{42u * sizeof(T) * N};
- for (auto& x : Examples) {
- x = prng();
- }
- }
-
- TVector<T> Examples;
- };
-}
-
-#define DEFINE_BENCHMARK(type, count) \
- Y_CPU_BENCHMARK(FastClp2_##type##_##count, iface) { \
- const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- for (const auto e : examples) { \
- Y_DO_NOT_OPTIMIZE_AWAY(FastClp2(e)); \
- } \
- } \
- }
-
-DEFINE_BENCHMARK(ui8, 1)
-DEFINE_BENCHMARK(ui8, 10)
-DEFINE_BENCHMARK(ui8, 100)
-DEFINE_BENCHMARK(ui16, 1)
-DEFINE_BENCHMARK(ui16, 10)
-DEFINE_BENCHMARK(ui16, 100)
-DEFINE_BENCHMARK(ui32, 1)
-DEFINE_BENCHMARK(ui32, 10)
-DEFINE_BENCHMARK(ui32, 100)
-DEFINE_BENCHMARK(ui64, 1)
-DEFINE_BENCHMARK(ui64, 10)
-DEFINE_BENCHMARK(ui64, 100)
-
-#undef DEFINE_BENCHMARKS
diff --git a/util/generic/benchmark/fastclp2/metrics/main.py b/util/generic/benchmark/fastclp2/metrics/main.py
deleted file mode 100644
index 5573c6a5d7..0000000000
--- a/util/generic/benchmark/fastclp2/metrics/main.py
+++ /dev/null
@@ -1,5 +0,0 @@
-import yatest.common as yc
-
-
-def test_export_metrics(metrics):
- metrics.set_benchmark(yc.execute_benchmark('util/generic/benchmark/fastclp2/fastclp2', threads=8))
diff --git a/util/generic/benchmark/log2/main.cpp b/util/generic/benchmark/log2/main.cpp
deleted file mode 100644
index 969f09a309..0000000000
--- a/util/generic/benchmark/log2/main.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-#include <library/cpp/testing/benchmark/bench.h>
-
-#include <library/cpp/fast_log/fast_log.h>
-
-#include <util/generic/singleton.h>
-#include <util/generic/vector.h>
-#include <util/random/fast.h>
-#include <util/generic/xrange.h>
-
-#include <cmath>
-namespace {
- template <typename T, size_t N>
- struct TExamplesHolder {
- TVector<T> Examples;
-
- TExamplesHolder()
- : Examples(N)
- {
- TFastRng<ui64> prng{N * 42};
- for (auto& x : Examples) {
- x = prng.GenRandReal4() + prng.Uniform(1932); // 1934 is just a random number
- }
- }
- };
-}
-
-#define DEFINE_BENCHMARK(type, count) \
- Y_CPU_BENCHMARK(libm_log2f_##type##_##count, iface) { \
- const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- for (const auto e : examples) { \
- Y_DO_NOT_OPTIMIZE_AWAY(log2f(e)); \
- } \
- } \
- } \
- \
- Y_CPU_BENCHMARK(libm_logf_##type##_##count, iface) { \
- const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- for (const auto e : examples) { \
- Y_DO_NOT_OPTIMIZE_AWAY(logf(e)); \
- } \
- } \
- } \
- Y_CPU_BENCHMARK(STL_Log2_##type##_##count, iface) { \
- const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- for (const auto e : examples) { \
- Y_DO_NOT_OPTIMIZE_AWAY(std::log2(e)); \
- } \
- } \
- } \
- \
- Y_CPU_BENCHMARK(STL_Log_##type##_##count, iface) { \
- const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- for (const auto e : examples) { \
- Y_DO_NOT_OPTIMIZE_AWAY(std::log(e)); \
- } \
- } \
- } \
- \
- Y_CPU_BENCHMARK(Fast_Log2_##type##_##count, iface) { \
- const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- for (const auto e : examples) { \
- Y_DO_NOT_OPTIMIZE_AWAY(FastLog2f(e)); \
- } \
- } \
- } \
- \
- Y_CPU_BENCHMARK(FastLogf##type##_##count, iface) { \
- const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- for (const auto e : examples) { \
- Y_DO_NOT_OPTIMIZE_AWAY(FastLogf(e)); \
- } \
- } \
- } \
- \
- Y_CPU_BENCHMARK(Faster_Log2_##type##_##count, iface) { \
- const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- for (const auto e : examples) { \
- Y_DO_NOT_OPTIMIZE_AWAY(FasterLog2f(e)); \
- } \
- } \
- } \
- \
- Y_CPU_BENCHMARK(Faster_Log_##type##_##count, iface) { \
- const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- for (const auto e : examples) { \
- Y_DO_NOT_OPTIMIZE_AWAY(FasterLogf(e)); \
- } \
- } \
- } \
- \
- Y_CPU_BENCHMARK(Fastest_Log2f_##type##_##count, iface) { \
- const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- for (const auto e : examples) { \
- Y_DO_NOT_OPTIMIZE_AWAY(FastestLog2f(e)); \
- } \
- } \
- } \
- \
- Y_CPU_BENCHMARK(Fastest_Log_##type##_##count, iface) { \
- const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- for (const auto e : examples) { \
- Y_DO_NOT_OPTIMIZE_AWAY(FastestLogf(e)); \
- } \
- } \
- }
-
-DEFINE_BENCHMARK(float, 1)
-DEFINE_BENCHMARK(float, 2)
-DEFINE_BENCHMARK(float, 4)
-DEFINE_BENCHMARK(float, 8)
-DEFINE_BENCHMARK(float, 16)
-DEFINE_BENCHMARK(float, 32)
-DEFINE_BENCHMARK(float, 64)
-DEFINE_BENCHMARK(float, 128)
-DEFINE_BENCHMARK(float, 256)
-DEFINE_BENCHMARK(float, 1024)
-DEFINE_BENCHMARK(float, 2048)
-DEFINE_BENCHMARK(float, 4096)
-
-#undef DEFINE_BENCHMARK
diff --git a/util/generic/benchmark/log2/metrics/main.py b/util/generic/benchmark/log2/metrics/main.py
deleted file mode 100644
index 26f6b57812..0000000000
--- a/util/generic/benchmark/log2/metrics/main.py
+++ /dev/null
@@ -1,5 +0,0 @@
-import yatest.common as yc
-
-
-def test_export_metrics(metrics):
- metrics.set_benchmark(yc.execute_benchmark('util/generic/benchmark/log2/log2', threads=8))
diff --git a/util/generic/benchmark/rotate_bits/main.cpp b/util/generic/benchmark/rotate_bits/main.cpp
deleted file mode 100644
index 057edbe864..0000000000
--- a/util/generic/benchmark/rotate_bits/main.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-#include <library/cpp/testing/benchmark/bench.h>
-
-#include <util/generic/vector.h>
-#include <util/generic/xrange.h>
-#include <util/generic/singleton.h>
-
-#include <util/random/fast.h>
-
-namespace {
- template <typename T>
- struct TExample {
- T Value;
- ui8 Shift;
- };
-
- template <typename T, size_t N>
- struct TExamplesHolder {
- TExamplesHolder()
- : Examples(N)
- {
- TFastRng<ui64> prng{42u * sizeof(T) * N};
- for (auto& e : Examples) {
- e.Value = prng();
- e.Shift = prng() % (8 * sizeof(T));
- }
- }
-
- TVector<TExample<T>> Examples;
- };
-}
-
-#define DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(type, count) \
- Y_CPU_BENCHMARK(LeftRotate_##type##_##count, iface) { \
- const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- for (const auto e : examples) { \
- Y_DO_NOT_OPTIMIZE_AWAY(RotateBitsLeft(e.Value, e.Shift)); \
- } \
- } \
- } \
- \
- Y_CPU_BENCHMARK(RightRotate_##type##_##count, iface) { \
- const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- for (const auto e : examples) { \
- Y_DO_NOT_OPTIMIZE_AWAY(RotateBitsRight(e.Value, e.Shift)); \
- } \
- } \
- }
-
-DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui8, 1)
-DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui8, 10)
-DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui8, 100)
-DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui16, 1)
-DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui16, 10)
-DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui16, 100)
-DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui32, 1)
-DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui32, 10)
-DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui32, 100)
-DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui64, 1)
-DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui64, 10)
-DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui64, 100)
-
-#undef DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES
diff --git a/util/generic/benchmark/rotate_bits/metrics/main.py b/util/generic/benchmark/rotate_bits/metrics/main.py
deleted file mode 100644
index b30555775f..0000000000
--- a/util/generic/benchmark/rotate_bits/metrics/main.py
+++ /dev/null
@@ -1,5 +0,0 @@
-import yatest.common as yc
-
-
-def test_export_metrics(metrics):
- metrics.set_benchmark(yc.execute_benchmark('util/generic/benchmark/rotate_bits/rotate_bits', threads=8))
diff --git a/util/generic/benchmark/singleton/f.cpp b/util/generic/benchmark/singleton/f.cpp
deleted file mode 100644
index bf6da53d9c..0000000000
--- a/util/generic/benchmark/singleton/f.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <util/generic/singleton.h>
-
-struct X {
- inline X() {
- }
-
- char Buf[100];
-};
-
-char& FF1() noexcept {
- static X x;
-
- return x.Buf[0];
-}
-
-char& FF2() noexcept {
- return Singleton<X>()->Buf[0];
-}
diff --git a/util/generic/benchmark/singleton/main.cpp b/util/generic/benchmark/singleton/main.cpp
deleted file mode 100644
index 2b06bd371d..0000000000
--- a/util/generic/benchmark/singleton/main.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-#include <library/cpp/testing/benchmark/bench.h>
-
-#include <util/generic/singleton.h>
-#include <util/generic/xrange.h>
-
-char& FF1() noexcept;
-char& FF2() noexcept;
-
-namespace {
- struct X {
- inline X() {
- }
-
- char Buf[100];
- };
-
- inline X& F1() noexcept {
- static X x;
-
- return x;
- }
-
- inline X& F2() noexcept {
- return *Singleton<X>();
- }
-}
-
-Y_CPU_BENCHMARK(MagicStatic, iface) {
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- Y_DO_NOT_OPTIMIZE_AWAY(F1().Buf);
- }
-}
-
-Y_CPU_BENCHMARK(Singleton, iface) {
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- Y_DO_NOT_OPTIMIZE_AWAY(F2().Buf);
- }
-}
-
-Y_CPU_BENCHMARK(MagicStaticNI, iface) {
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- Y_DO_NOT_OPTIMIZE_AWAY(FF1());
- }
-}
-
-Y_CPU_BENCHMARK(SingletonNI, iface) {
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- Y_DO_NOT_OPTIMIZE_AWAY(FF2());
- }
-}
diff --git a/util/generic/benchmark/smart_pointers/main.cpp b/util/generic/benchmark/smart_pointers/main.cpp
deleted file mode 100644
index 92c2f923bb..0000000000
--- a/util/generic/benchmark/smart_pointers/main.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <library/cpp/testing/benchmark/bench.h>
-
-#include <util/generic/ptr.h>
-#include <util/generic/xrange.h>
-
-struct X: public TAtomicRefCount<X> {
-};
-
-Y_CPU_BENCHMARK(SimplePtrConstruct, iface) {
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- Y_DO_NOT_OPTIMIZE_AWAY(TSimpleIntrusivePtr<X>());
- }
-}
diff --git a/util/generic/benchmark/sort/main.cpp b/util/generic/benchmark/sort/main.cpp
deleted file mode 100644
index d58f491f4d..0000000000
--- a/util/generic/benchmark/sort/main.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-#include <library/cpp/testing/benchmark/bench.h>
-
-#include <util/generic/algorithm.h>
-#include <util/generic/vector.h>
-#include <util/generic/xrange.h>
-
-Y_CPU_BENCHMARK(Sort1, iface) {
- TVector<int> x = {1};
-
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- Sort(x);
- }
-}
-
-Y_CPU_BENCHMARK(Sort2, iface) {
- TVector<int> x = {2, 1};
-
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- Sort(x);
- }
-}
-
-Y_CPU_BENCHMARK(Sort4, iface) {
- TVector<int> x = {4, 3, 2, 1};
-
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- Sort(x);
- }
-}
-
-Y_CPU_BENCHMARK(Sort16, iface) {
- TVector<int> x = {16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
-
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- Sort(x);
- }
-}
-
-Y_CPU_BENCHMARK(StableSort1, iface) {
- TVector<int> x = {1};
-
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- StableSort(x);
- }
-}
-
-Y_CPU_BENCHMARK(StableSort2, iface) {
- TVector<int> x = {2, 1};
-
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- StableSort(x);
- }
-}
-
-Y_CPU_BENCHMARK(StableSort4, iface) {
- TVector<int> x = {4, 3, 2, 1};
-
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- StableSort(x);
- }
-}
-
-Y_CPU_BENCHMARK(StableSort16, iface) {
- TVector<int> x = {16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
-
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- StableSort(x);
- }
-}
diff --git a/util/generic/benchmark/string/benchmarks.h b/util/generic/benchmark/string/benchmarks.h
deleted file mode 100644
index e347d7ff47..0000000000
--- a/util/generic/benchmark/string/benchmarks.h
+++ /dev/null
@@ -1,188 +0,0 @@
-#pragma once
-
-// Define BENCHMARK_PREFIX and BENCHMARKED_CLASS before including this file.
-
-#include <util/generic/xrange.h>
-
-#define Y_CPU_PREFIXED_BENCHMARK_HELPER(prefix, name, iface) Y_CPU_BENCHMARK(prefix##name, iface)
-#define Y_CPU_PREFIXED_BENCHMARK(prefix, name, iface) Y_CPU_PREFIXED_BENCHMARK_HELPER(prefix, name, iface)
-#define CONCATENATE3_HELPER(a, b, c) a##b##c
-#define CONCATENATE3(a, b, c) CONCATENATE3_HELPER(a, b, c)
-
-namespace {
- namespace CONCATENATE3(N, BENCHMARK_PREFIX, Benchmark) {
- using TBenchmarkedClass = BENCHMARKED_CLASS;
-
- const auto defaultString = TBenchmarkedClass();
- const auto emptyString = TBenchmarkedClass("");
- const auto lengthOneString = TBenchmarkedClass("1");
- const auto length1KString = TBenchmarkedClass(1000, '1');
-
- Y_CPU_PREFIXED_BENCHMARK(BENCHMARK_PREFIX, CreateDefault, iface) {
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- auto result = TBenchmarkedClass();
- Y_DO_NOT_OPTIMIZE_AWAY(result);
- }
- }
-
- Y_CPU_PREFIXED_BENCHMARK(BENCHMARK_PREFIX, CreateFromEmptyLiteral, iface) {
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- auto result = TBenchmarkedClass("");
- Y_DO_NOT_OPTIMIZE_AWAY(result);
- }
- }
-
- Y_CPU_PREFIXED_BENCHMARK(BENCHMARK_PREFIX, CreateFromLengthOneLiteral, iface) {
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- auto result = TBenchmarkedClass("1");
- Y_DO_NOT_OPTIMIZE_AWAY(result);
- }
- }
-
- Y_CPU_PREFIXED_BENCHMARK(BENCHMARK_PREFIX, CreateLength1K, iface) {
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- auto result = TBenchmarkedClass(1000, '1');
- Y_DO_NOT_OPTIMIZE_AWAY(result);
- }
- }
-
- Y_CPU_PREFIXED_BENCHMARK(BENCHMARK_PREFIX, CopyDefaultString, iface) {
- const auto& sourceString = defaultString;
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- auto result = TBenchmarkedClass(sourceString);
- Y_DO_NOT_OPTIMIZE_AWAY(result);
- }
- }
-
- Y_CPU_PREFIXED_BENCHMARK(BENCHMARK_PREFIX, CopyEmptyString, iface) {
- const auto& sourceString = emptyString;
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- auto result = TBenchmarkedClass(sourceString);
- Y_DO_NOT_OPTIMIZE_AWAY(result);
- }
- }
-
- Y_CPU_PREFIXED_BENCHMARK(BENCHMARK_PREFIX, CopyLengthOneString, iface) {
- const auto& sourceString = lengthOneString;
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- auto result = TBenchmarkedClass(sourceString);
- Y_DO_NOT_OPTIMIZE_AWAY(result);
- }
- }
-
- Y_CPU_PREFIXED_BENCHMARK(BENCHMARK_PREFIX, CopyLength1KString, iface) {
- const auto& sourceString = length1KString;
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- auto result = TBenchmarkedClass(sourceString);
- Y_DO_NOT_OPTIMIZE_AWAY(result);
- }
- }
-
- Y_CPU_PREFIXED_BENCHMARK(BENCHMARK_PREFIX, CopyAndUpdateLengthOneString, iface) {
- const auto& sourceString = lengthOneString;
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- auto targetString = TBenchmarkedClass(sourceString);
- auto result = targetString[0] = '0';
- Y_DO_NOT_OPTIMIZE_AWAY(targetString);
- Y_DO_NOT_OPTIMIZE_AWAY(result);
- }
- }
-
- Y_CPU_PREFIXED_BENCHMARK(BENCHMARK_PREFIX, CopyAndAppendDefaultString, iface) {
- const auto& sourceString = defaultString;
- const TBenchmarkedClass::size_type insertPosition = sourceString.size();
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- auto targetString = TBenchmarkedClass(sourceString);
- auto result = targetString.insert(insertPosition, 1, '0');
- Y_DO_NOT_OPTIMIZE_AWAY(targetString);
- Y_DO_NOT_OPTIMIZE_AWAY(result);
- }
- }
-
- Y_CPU_PREFIXED_BENCHMARK(BENCHMARK_PREFIX, CopyAndAppendEmptyString, iface) {
- const auto& sourceString = emptyString;
- const TBenchmarkedClass::size_type insertPosition = sourceString.size();
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- auto targetString = TBenchmarkedClass(sourceString);
- auto result = targetString.insert(insertPosition, 1, '0');
- Y_DO_NOT_OPTIMIZE_AWAY(targetString);
- Y_DO_NOT_OPTIMIZE_AWAY(result);
- }
- }
-
- Y_CPU_PREFIXED_BENCHMARK(BENCHMARK_PREFIX, CopyAndAppendLengthOneString, iface) {
- const auto& sourceString = lengthOneString;
- const TBenchmarkedClass::size_type insertPosition = sourceString.size();
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- auto targetString = TBenchmarkedClass(sourceString);
- auto result = targetString.insert(insertPosition, 1, '0');
- Y_DO_NOT_OPTIMIZE_AWAY(targetString);
- Y_DO_NOT_OPTIMIZE_AWAY(result);
- }
- }
-
- Y_CPU_PREFIXED_BENCHMARK(BENCHMARK_PREFIX, CopyAndPrependLengthOneString, iface) {
- const auto& sourceString = lengthOneString;
- const TBenchmarkedClass::size_type insertPosition = 0;
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- auto targetString = TBenchmarkedClass(sourceString);
- auto result = targetString.insert(insertPosition, 1, '0');
- Y_DO_NOT_OPTIMIZE_AWAY(targetString);
- Y_DO_NOT_OPTIMIZE_AWAY(result);
- }
- }
-
- Y_CPU_PREFIXED_BENCHMARK(BENCHMARK_PREFIX, CopyAndUpdateLength1KString, iface) {
- const auto& sourceString = length1KString;
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- auto targetString = TBenchmarkedClass(sourceString);
- auto result = targetString[0] = '0';
- Y_DO_NOT_OPTIMIZE_AWAY(targetString);
- Y_DO_NOT_OPTIMIZE_AWAY(result);
- }
- }
-
- Y_CPU_PREFIXED_BENCHMARK(BENCHMARK_PREFIX, CopyAndAppendLength1KString, iface) {
- const auto& sourceString = length1KString;
- const TBenchmarkedClass::size_type insertPosition = sourceString.size();
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- auto targetString = TBenchmarkedClass(sourceString);
- auto result = targetString.insert(insertPosition, 1, '0');
- Y_DO_NOT_OPTIMIZE_AWAY(targetString);
- Y_DO_NOT_OPTIMIZE_AWAY(result);
- }
- }
-
- Y_CPU_PREFIXED_BENCHMARK(BENCHMARK_PREFIX, CopyAndPrependLength1KString, iface) {
- const auto& sourceString = length1KString;
- const TBenchmarkedClass::size_type insertPosition = 0;
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- auto targetString = TBenchmarkedClass(sourceString);
- auto result = targetString.insert(insertPosition, 1, '0');
- Y_DO_NOT_OPTIMIZE_AWAY(targetString);
- Y_DO_NOT_OPTIMIZE_AWAY(result);
- }
- }
- }
-}
-
-#undef CONCATENATE3
-#undef CONCATENATE3_HELPER
-#undef Y_CPU_PREFIXED_BENCHMARK
-#undef Y_CPU_PREFIXED_BENCHMARK_HELPER
diff --git a/util/generic/benchmark/string/std_string.cpp b/util/generic/benchmark/string/std_string.cpp
deleted file mode 100644
index cb10b4dc0c..0000000000
--- a/util/generic/benchmark/string/std_string.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <library/cpp/testing/benchmark/bench.h>
-
-#include <string>
-
-#define BENCHMARK_PREFIX StdString
-#define BENCHMARKED_CLASS std::string
-
-#include "benchmarks.h"
diff --git a/util/generic/benchmark/string/string.cpp b/util/generic/benchmark/string/string.cpp
deleted file mode 100644
index c634c204d8..0000000000
--- a/util/generic/benchmark/string/string.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <library/cpp/testing/benchmark/bench.h>
-
-#include <util/generic/string.h>
-
-#define BENCHMARK_PREFIX TString
-#define BENCHMARKED_CLASS ::TString
-
-#include "benchmarks.h"
diff --git a/util/generic/benchmark/vector_count_ctor/f.cpp b/util/generic/benchmark/vector_count_ctor/f.cpp
deleted file mode 100644
index b89e351ba7..0000000000
--- a/util/generic/benchmark/vector_count_ctor/f.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-#include "f.h"
-
-#include <library/cpp/testing/benchmark/bench.h>
-
-#include <util/generic/vector.h>
-#include <util/generic/ptr.h>
-
-void CreateYvector(const size_t size, const size_t count) {
- for (size_t i = 0; i < count; ++i) {
- NBench::Clobber();
- TVector<ui8> v(size);
- NBench::Escape(v.data());
- NBench::Clobber();
- }
-}
-
-void CreateCarray(const size_t size, const size_t count) {
- for (size_t i = 0; i < count; ++i) {
- NBench::Clobber();
- TArrayHolder<ui8> v(new ui8[size]);
- memset(v.Get(), 0, size * sizeof(ui8));
- NBench::Escape(v.Get());
- NBench::Clobber();
- }
-}
diff --git a/util/generic/benchmark/vector_count_ctor/f.h b/util/generic/benchmark/vector_count_ctor/f.h
deleted file mode 100644
index a568341a45..0000000000
--- a/util/generic/benchmark/vector_count_ctor/f.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#pragma once
-
-#include <cstddef>
-
-// functions are declared in a separate translation unit so that compiler won't be able to see the
-// value of `size` during compilation.
-
-void CreateYvector(const size_t size, const size_t count);
-void CreateCarray(const size_t size, const size_t count);
diff --git a/util/generic/benchmark/vector_count_ctor/main.cpp b/util/generic/benchmark/vector_count_ctor/main.cpp
deleted file mode 100644
index 6fb1fda9c9..0000000000
--- a/util/generic/benchmark/vector_count_ctor/main.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-#include "f.h"
-
-#include <library/cpp/testing/benchmark/bench.h>
-
-#define DEFINE_BENCHMARK(N) \
- Y_CPU_BENCHMARK(Yvector_##N, iface) { \
- CreateYvector(N, iface.Iterations()); \
- } \
- Y_CPU_BENCHMARK(Carray_##N, iface) { \
- CreateCarray(N, iface.Iterations()); \
- }
-
-DEFINE_BENCHMARK(1)
-DEFINE_BENCHMARK(2)
-DEFINE_BENCHMARK(8)
-DEFINE_BENCHMARK(10)
-DEFINE_BENCHMARK(16)
-DEFINE_BENCHMARK(20)
-DEFINE_BENCHMARK(1000)
-DEFINE_BENCHMARK(1024)
-DEFINE_BENCHMARK(8192)
-DEFINE_BENCHMARK(10000)
-DEFINE_BENCHMARK(65536)
-DEFINE_BENCHMARK(100000)
-DEFINE_BENCHMARK(4194304)
-DEFINE_BENCHMARK(1000000)
-DEFINE_BENCHMARK(33554432)
-DEFINE_BENCHMARK(10000000)
-DEFINE_BENCHMARK(268435456)
-DEFINE_BENCHMARK(100000000)
diff --git a/util/generic/benchmark/vector_count_ctor/metrics/main.py b/util/generic/benchmark/vector_count_ctor/metrics/main.py
deleted file mode 100644
index 835b44fe5f..0000000000
--- a/util/generic/benchmark/vector_count_ctor/metrics/main.py
+++ /dev/null
@@ -1,5 +0,0 @@
-import yatest.common as yc
-
-
-def test_export_metrics(metrics):
- metrics.set_benchmark(yc.execute_benchmark('util/generic/benchmark/vector_count_ctor/vector_count_ctor', threads=8))
diff --git a/util/generic/fuzz/vector/main.cpp b/util/generic/fuzz/vector/main.cpp
deleted file mode 100644
index 0a0293f795..0000000000
--- a/util/generic/fuzz/vector/main.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-#include <util/generic/vector.h>
-#include <util/stream/mem.h>
-
-template <class T>
-static inline T Read(IInputStream& in) {
- T t;
-
- in.LoadOrFail(&t, sizeof(t));
-
- return t;
-}
-
-extern "C" int LLVMFuzzerTestOneInput(const ui8* data, size_t size) {
- TMemoryInput mi(data, size);
-
- try {
- TVector<ui16> v;
-
- while (mi.Avail()) {
- char cmd = Read<char>(mi);
-
- switch (cmd % 2) {
- case 0: {
- const size_t cnt = 1 + Read<ui8>(mi) % 16;
-
- for (size_t i = 0; i < cnt; ++i) {
- v.push_back(i);
- }
-
- break;
- }
-
- case 1: {
- if (v) {
- v.pop_back();
- }
-
- break;
- }
- }
- }
- } catch (...) {
- // ¯\_(ツ)_/¯
- }
-
- return 0; // Non-zero return values are reserved for future use.
-}
diff --git a/util/generic/va_args_gen.py b/util/generic/va_args_gen.py
deleted file mode 100755
index 232b53fca6..0000000000
--- a/util/generic/va_args_gen.py
+++ /dev/null
@@ -1,211 +0,0 @@
-#!/usr/bin/env python
-"""
-Generates some handy macros for preprocessor metaprogramming.
-
-"""
-
-from __future__ import print_function
-
-import sys
-import textwrap
-
-if sys.version_info >= (3, 0, 0):
- xrange = range
-
-
-def generate(limit):
- print('#pragma once')
- print(textwrap.dedent('''
- /// @file va_args.h
- ///
- /// Some handy macros for preprocessor metaprogramming.
- '''.rstrip()))
- print('')
- command = ' '.join(sys.argv)
- print('// NOTE: this file has been generated with "{}", do not edit -- use the generator instead'.format(command))
- print('')
- print('// DO_NOT_STYLE')
- print('')
- print('#include <util/system/defaults.h>')
- print('')
-
- pass_va_args()
- count(limit)
- get_elem(limit)
- map_args(limit)
- map_args_n(limit)
- map_args_with_last(limit)
- map_args_with_last_n(limit)
- all_but_last(limit)
- last(limit)
- impl_dispatcher()
-
-
-def pass_va_args():
- print(textwrap.dedent('''
- /**
- * Triggers another level of macro expansion, use whenever passing __VA_ARGS__ to another macro.
- *
- * Used merely for working around an MSVC++ bug.
- * See http://stackoverflow.com/questions/5134523/msvc-doesnt-expand-va-args-correctly
- */
- '''.rstrip()))
- print('#define Y_PASS_VA_ARGS(x) x')
-
-
-def count(limit):
- print(textwrap.dedent('''
- /**
- * Count number of arguments in `__VA_ARGS__`.
- * Doesn't work with empty arguments list.
- */
- '''.rstrip()))
- numbers = ', '.join(map(str, xrange(limit, -1, -1)))
- u_numbers = ', '.join(map('_{}'.format, xrange(limit, 0, -1)))
- print('#define Y_COUNT_ARGS(...) Y_PASS_VA_ARGS('
- '__Y_COUNT_ARGS(__VA_ARGS__, {}))'.format(numbers))
- print('#define __Y_COUNT_ARGS({}, N, ...) N'.format(u_numbers))
-
-
-def get_elem(limit):
- print(textwrap.dedent('''
- /**
- * Get the i-th element from `__VA_ARGS__`.
- */
- '''.rstrip()))
- print('#define Y_GET_ARG(N, ...) Y_PASS_VA_ARGS(Y_PASS_VA_ARGS(Y_CAT(__Y_GET_ARG_, '
- 'N))(__VA_ARGS__))')
- for i in xrange(0, limit + 1):
- args = ', '.join(map('_{}'.format, xrange(i + 1)))
- print('#define __Y_GET_ARG_{}({}, ...) _{}'.format(i, args, i))
-
-
-def map_args(limit):
- print(textwrap.dedent('''
- /**
- * Expands a macro for each of the variable arguments.
- * Doesn't work with empty arguments list.
- */
- '''.rstrip()))
- print('#define Y_MAP_ARGS(ACTION, ...) Y_PASS_VA_ARGS(Y_PASS_VA_ARGS(Y_CAT('
- '__Y_MAP_ARGS_, Y_COUNT_ARGS(__VA_ARGS__)))(ACTION, __VA_ARGS__))')
- print('#define __Y_MAP_ARGS_0(...)')
- print('#define __Y_MAP_ARGS_1(ACTION, x, ...) ACTION(x)')
- for i in xrange(2, limit + 1):
- print('#define __Y_MAP_ARGS_{}(ACTION, x, ...) ACTION(x) Y_PASS_VA_ARGS(__Y_MAP_ARGS_{}('
- 'ACTION, __VA_ARGS__))'.format(i, i - 1))
-
-
-def map_args_n(limit):
- print(textwrap.dedent('''
- /**
- * Expands a macro for each of the variable arguments with it's sequence number and value.
- * Corresponding sequence numbers will expand in descending order.
- * Doesn't work with empty arguments list.
- */
- '''.rstrip()))
- print('#define Y_MAP_ARGS_N(ACTION, ...) Y_PASS_VA_ARGS(Y_PASS_VA_ARGS(Y_CAT('
- '__Y_MAP_ARGS_N_, Y_COUNT_ARGS(__VA_ARGS__)))(ACTION, __VA_ARGS__))')
- print('#define __Y_MAP_ARGS_N_0(...)')
- print('#define __Y_MAP_ARGS_N_1(ACTION, x, ...) ACTION(1, x)')
- for i in xrange(2, limit + 1):
- print('#define __Y_MAP_ARGS_N_{}(ACTION, x, ...) ACTION({}, x) Y_PASS_VA_ARGS(__Y_MAP_ARGS_N_{}('
- 'ACTION, __VA_ARGS__))'.format(i, i, i - 1))
-
-
-def map_args_with_last(limit):
- print(textwrap.dedent('''
- /**
- * Expands a macro for each of the variable arguments.
- * Doesn't work with empty arguments list.
- */
- '''.rstrip()))
- print('#define Y_MAP_ARGS_WITH_LAST(ACTION, LAST_ACTION, ...) Y_PASS_VA_ARGS(Y_PASS_VA_ARGS('
- 'Y_CAT(__Y_MAP_ARGS_WITH_LAST_, Y_COUNT_ARGS(__VA_ARGS__)))(ACTION, LAST_ACTION, '
- '__VA_ARGS__))')
- print('#define __Y_MAP_ARGS_WITH_LAST_0(...)')
- print('#define __Y_MAP_ARGS_WITH_LAST_1(ACTION, LAST_ACTION, x, ...) LAST_ACTION(x)')
- for i in xrange(2, limit + 1):
- print('#define __Y_MAP_ARGS_WITH_LAST_{}(ACTION, LAST_ACTION, x, ...) ACTION(x) Y_PASS_VA_ARGS('
- '__Y_MAP_ARGS_WITH_LAST_{}(ACTION, LAST_ACTION, __VA_ARGS__))'.format(i, i - 1))
-
-
-def map_args_with_last_n(limit):
- print(textwrap.dedent('''
- /**
- * Expands a macro for each of the variable arguments with it's sequence number and value.
- * Corresponding sequence numbers will expand in descending order.
- * Doesn't work with empty arguments list.
- */
- '''.rstrip()))
- print('#define Y_MAP_ARGS_WITH_LAST_N(ACTION, LAST_ACTION, ...) Y_PASS_VA_ARGS(Y_PASS_VA_ARGS('
- 'Y_CAT(__Y_MAP_ARGS_WITH_LAST_N_, Y_COUNT_ARGS(__VA_ARGS__)))(ACTION, LAST_ACTION, '
- '__VA_ARGS__))')
- print('#define __Y_MAP_ARGS_WITH_LAST_N_0(...)')
- print('#define __Y_MAP_ARGS_WITH_LAST_N_1(ACTION, LAST_ACTION, x, ...) LAST_ACTION(1, x)')
- for i in xrange(2, limit + 1):
- print('#define __Y_MAP_ARGS_WITH_LAST_N_{}(ACTION, LAST_ACTION, x, ...) ACTION({}, x) Y_PASS_VA_ARGS('
- '__Y_MAP_ARGS_WITH_LAST_N_{}(ACTION, LAST_ACTION, __VA_ARGS__))'.format(i, i, i - 1))
-
-
-def all_but_last(limit):
- print(textwrap.dedent('''
- /**
- * Get all elements but the last one from `__VA_ARGS__`.
- * Doesn't work with empty arguments list.
- */
- '''.rstrip()))
- print('#define Y_ALL_BUT_LAST(...) Y_PASS_VA_ARGS(Y_PASS_VA_ARGS(Y_CAT(__Y_ALL_BUT_LAST_, '
- 'Y_COUNT_ARGS(__VA_ARGS__)))(__VA_ARGS__))')
- print('#define __Y_ALL_BUT_LAST_0(...)')
- print('#define __Y_ALL_BUT_LAST_1(...)')
- for i in xrange(2, limit + 1):
- args = ', '.join(map('_{}'.format, xrange(i - 1)))
- print('#define __Y_ALL_BUT_LAST_{}({}, ...) {}'.format(i, args, args))
-
-
-def last(limit):
- print(textwrap.dedent('''
- /**
- * Get the last element from `__VA_ARGS__`.
- * Doesn't work with empty arguments list.
- */
- '''.rstrip()))
- print('#define Y_LAST(...) Y_PASS_VA_ARGS('
- 'Y_GET_ARG(Y_COUNT_ARGS(__VA_ARGS__), , __VA_ARGS__, {}))'.format(',' * limit))
-
-
-def impl_dispatcher():
- print(textwrap.dedent('''
- /**
- * Macros for implementing overload by number of arguments.
- *
- * Example usage:
- *
- * @code{cpp}
- * #define I1(arg1) Cout << Y_STRINGIZE(arg1) << Endl;
- * #define I2(arg1, arg2) Cout << Y_STRINGIZE(arg1) << ';' << Y_STRINGIZE(arg2) << Endl;
- *
- * #define Y_PRINT(...) Y_PASS_VA_ARGS(Y_MACRO_IMPL_DISPATCHER_2(__VA_ARGS__, I2, I1)(__VA_ARGS__))
- * @endcode
- */
- '''.rstrip()))
- print('/// @{')
- for i in xrange(2, 11):
- args = ', '.join(map('_{}'.format, xrange(i)))
- print('#define Y_MACRO_IMPL_DISPATCHER_{}({}, IMPL, ...) IMPL'.format(i, args))
- print('/// }@')
-
-
-def main():
- if len(sys.argv) > 2:
- sys.stderr.write('Usage: {} [limit=50]\n'.format(sys.argv[0]))
- sys.exit(1)
- limit = 50
- if len(sys.argv) == 2:
- limit = int(sys.argv[1])
- generate(limit)
-
-
-if __name__ == '__main__':
- main()
diff --git a/util/memory/benchmark/pool/main.cpp b/util/memory/benchmark/pool/main.cpp
deleted file mode 100644
index 0b4d6c94af..0000000000
--- a/util/memory/benchmark/pool/main.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <library/cpp/testing/benchmark/bench.h>
-
-#include <util/memory/pool.h>
-#include <util/generic/xrange.h>
-#include <util/stream/output.h>
-
-#define BENCHMARK_POOL_ALLOC(chunkSize, allocSize, allocAlign) \
- Y_CPU_BENCHMARK(MemroyPool_chunk##chunkSize##_alloc##allocSize##_align##allocAlign, p) { \
- TMemoryPool pool(chunkSize); \
- for (auto i : xrange<size_t>(0, p.Iterations())) { \
- (void)i; \
- Y_DO_NOT_OPTIMIZE_AWAY(pool.Allocate(allocSize, allocAlign)); \
- } \
- /* \
- Cerr << "Allocated: " << pool.MemoryAllocated() << Endl; \
- Cerr << "Waste: " << pool.MemoryWaste() << Endl; \
- */ \
- }
-
-BENCHMARK_POOL_ALLOC(4096, 1, 1)
-BENCHMARK_POOL_ALLOC(4096, 2, 2)
-BENCHMARK_POOL_ALLOC(4096, 3, 4)
-BENCHMARK_POOL_ALLOC(4096, 7, 8)
-BENCHMARK_POOL_ALLOC(4096, 17, 16)
-BENCHMARK_POOL_ALLOC(4096, 40, 64)
-BENCHMARK_POOL_ALLOC(4096, 77, 128)
diff --git a/util/memory/benchmark/pool/metrics/main.py b/util/memory/benchmark/pool/metrics/main.py
deleted file mode 100644
index cc17b7b888..0000000000
--- a/util/memory/benchmark/pool/metrics/main.py
+++ /dev/null
@@ -1,5 +0,0 @@
-import yatest.common as yc
-
-
-def test_export_metrics(metrics):
- metrics.set_benchmark(yc.execute_benchmark('util/memory/benchmark/pool/pool', threads=8))
diff --git a/util/random/benchmark/prng/main.cpp b/util/random/benchmark/prng/main.cpp
deleted file mode 100644
index 2c6279ff71..0000000000
--- a/util/random/benchmark/prng/main.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-#include <library/cpp/testing/benchmark/bench.h>
-
-#include <util/random/entropy.h>
-#include <util/random/fast.h>
-#include <util/random/normal.h>
-#include <util/random/mersenne.h>
-#include <util/system/compiler.h>
-#include <util/generic/xrange.h>
-
-#include <random>
-
-// double part
-Y_CPU_BENCHMARK(Mersenne32_Double, p) {
- TMersenne<ui32> rng(Seed());
-
- for (auto i : xrange<size_t>(0, p.Iterations())) {
- (void)i;
- Y_DO_NOT_OPTIMIZE_AWAY(rng.GenRandReal1());
- }
-}
-
-Y_CPU_BENCHMARK(Mersenne64_Double, p) {
- TMersenne<ui64> rng(Seed());
-
- for (auto i : xrange<size_t>(0, p.Iterations())) {
- (void)i;
- Y_DO_NOT_OPTIMIZE_AWAY(rng.GenRandReal1());
- }
-}
-
-Y_CPU_BENCHMARK(Fast32_Double, p) {
- TFastRng<ui32> rng(Seed());
-
- for (auto i : xrange<size_t>(0, p.Iterations())) {
- (void)i;
- Y_DO_NOT_OPTIMIZE_AWAY(rng.GenRandReal1());
- }
-}
-
-Y_CPU_BENCHMARK(Fast64_Double, p) {
- TFastRng<ui64> rng(Seed());
-
- for (auto i : xrange<size_t>(0, p.Iterations())) {
- (void)i;
- Y_DO_NOT_OPTIMIZE_AWAY(rng.GenRandReal1());
- }
-}
-
-// integer part
-Y_CPU_BENCHMARK(mt19937_32, p) {
- std::mt19937 mt;
-
- for (auto i : xrange<size_t>(0, p.Iterations())) {
- (void)i;
-
- Y_DO_NOT_OPTIMIZE_AWAY(mt());
- }
-}
-
-Y_CPU_BENCHMARK(mt19937_64, p) {
- std::mt19937_64 mt;
-
- for (auto i : xrange<size_t>(0, p.Iterations())) {
- (void)i;
-
- Y_DO_NOT_OPTIMIZE_AWAY(mt());
- }
-}
-
-Y_CPU_BENCHMARK(Mersenne32_GenRand, p) {
- TMersenne<ui32> rng(Seed());
-
- for (auto i : xrange<size_t>(0, p.Iterations())) {
- (void)i;
- Y_DO_NOT_OPTIMIZE_AWAY(rng.GenRand());
- }
-}
-
-Y_CPU_BENCHMARK(Mersenne64_GenRand, p) {
- TMersenne<ui64> rng(Seed());
-
- for (auto i : xrange<size_t>(0, p.Iterations())) {
- (void)i;
- Y_DO_NOT_OPTIMIZE_AWAY(rng.GenRand());
- }
-}
-
-Y_CPU_BENCHMARK(Fast32_GenRand, p) {
- TFastRng<ui32> rng(Seed());
-
- for (auto i : xrange<size_t>(0, p.Iterations())) {
- (void)i;
- Y_DO_NOT_OPTIMIZE_AWAY(rng.GenRand());
- }
-}
-
-Y_CPU_BENCHMARK(Fast64_GenRand, p) {
- TFastRng<ui64> rng(Seed());
-
- for (auto i : xrange<size_t>(0, p.Iterations())) {
- (void)i;
- Y_DO_NOT_OPTIMIZE_AWAY(rng.GenRand());
- }
-}
-
-Y_CPU_BENCHMARK(StlNormal, p) {
- TFastRng<ui64> rng(Seed());
- std::normal_distribution<double> d(1.0, 0.0);
-
- for (auto i : xrange<size_t>(0, p.Iterations())) {
- (void)i;
- Y_DO_NOT_OPTIMIZE_AWAY(d(rng));
- }
-}
-
-Y_CPU_BENCHMARK(UtilNormal, p) {
- TFastRng<ui64> rng(Seed());
-
- for (auto i : xrange<size_t>(0, p.Iterations())) {
- (void)i;
- Y_DO_NOT_OPTIMIZE_AWAY(NormalDistribution<double>(rng, 1.0, 0.0));
- }
-}
diff --git a/util/random/benchmark/prng/metrics/main.py b/util/random/benchmark/prng/metrics/main.py
deleted file mode 100644
index 15b371fe75..0000000000
--- a/util/random/benchmark/prng/metrics/main.py
+++ /dev/null
@@ -1,5 +0,0 @@
-import yatest.common as yc
-
-
-def test_export_metrics(metrics):
- metrics.set_benchmark(yc.execute_benchmark('util/random/benchmark/prng/prng', threads=8))
diff --git a/util/string/benchmark/ascii/main.cpp b/util/string/benchmark/ascii/main.cpp
deleted file mode 100644
index 673047025d..0000000000
--- a/util/string/benchmark/ascii/main.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-#include <library/cpp/testing/benchmark/bench.h>
-
-#include <util/generic/xrange.h>
-#include <util/string/ascii.h>
-#include <util/generic/bitmap.h>
-#include <util/generic/singleton.h>
-
-namespace {
- struct TUpperMap: public TBitMap<256> {
- inline TUpperMap() noexcept {
- for (unsigned i = 'A'; i <= 'Z'; ++i) {
- Set((ui8)i);
- }
- }
-
- inline char ToLower(char x) const noexcept {
- return Get((ui8)x) ? x + ('a' - 'A') : x;
- }
- };
-
- struct TToLowerLookup {
- char Table[256];
-
- TToLowerLookup() {
- for (size_t i : xrange(256)) {
- Table[i] = AsciiToLower(i);
- }
- }
-
- char ToLower(char x) const noexcept {
- return Table[(ui8)x];
- }
- };
-}
-
-static inline char FastAsciiToLower(char c) {
- return (c >= 'A' && c <= 'Z') ? (c + ('a' - 'A')) : c;
-}
-
-static inline char FastAsciiToLower2(char c) {
- return c + ('a' - 'A') * (int)(c >= 'A' && c <= 'Z');
-}
-
-Y_CPU_BENCHMARK(AsciiToLower, iface) {
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
-
- for (int j = 0; j < 256; ++j) {
- Y_DO_NOT_OPTIMIZE_AWAY(AsciiToLower(j));
- }
- }
-}
-
-Y_CPU_BENCHMARK(AsciiToLowerChar, iface) {
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
-
- for (int j = 0; j < 256; ++j) {
- Y_DO_NOT_OPTIMIZE_AWAY(AsciiToLower((char)j));
- }
- }
-}
-
-Y_CPU_BENCHMARK(FastAsciiToLower, iface) {
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
-
- for (int j = 0; j < 256; ++j) {
- Y_DO_NOT_OPTIMIZE_AWAY(FastAsciiToLower(j));
- }
- }
-}
-
-Y_CPU_BENCHMARK(FastAsciiToLower2, iface) {
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
-
- for (int j = 0; j < 256; ++j) {
- Y_DO_NOT_OPTIMIZE_AWAY(FastAsciiToLower2(j));
- }
- }
-}
-
-Y_CPU_BENCHMARK(BitMapAsciiToLower, iface) {
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
-
- for (int j = 0; j < 256; ++j) {
- Y_DO_NOT_OPTIMIZE_AWAY(Singleton<TUpperMap>()->ToLower(j));
- }
- }
-}
-
-Y_CPU_BENCHMARK(LookupAsciiToLower, iface) {
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
-
- for (int j = 0; j < 256; ++j) {
- Y_DO_NOT_OPTIMIZE_AWAY(Singleton<TToLowerLookup>()->ToLower(j));
- }
- }
-}
-
-Y_CPU_BENCHMARK(LookupAsciiToLowerNoSingleton, iface) {
- TToLowerLookup lookup;
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
-
- for (int j = 0; j < 256; ++j) {
- Y_DO_NOT_OPTIMIZE_AWAY(lookup.ToLower(j));
- }
- }
-}
-
-Y_CPU_BENCHMARK(tolower, iface) {
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
-
- for (int j = 0; j < 256; ++j) {
- Y_DO_NOT_OPTIMIZE_AWAY(tolower(j));
- }
- }
-}
diff --git a/util/string/benchmark/cast/main.cpp b/util/string/benchmark/cast/main.cpp
deleted file mode 100644
index f604712ab6..0000000000
--- a/util/string/benchmark/cast/main.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-#include <library/cpp/testing/benchmark/bench.h>
-
-#include <util/string/cast.h>
-#include <util/generic/xrange.h>
-
-char str1[] = "1";
-char str12[] = "12";
-char str1234[] = "1234";
-char str12345678[] = "12345678";
-
-Y_CPU_BENCHMARK(Parse_1, iface) {
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- Y_DO_NOT_OPTIMIZE_AWAY(FromString<ui32>(str1, 1));
- }
-}
-
-Y_CPU_BENCHMARK(Parse_12, iface) {
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- Y_DO_NOT_OPTIMIZE_AWAY(FromString<ui32>(str12, 2));
- }
-}
-
-Y_CPU_BENCHMARK(Parse_1234, iface) {
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- Y_DO_NOT_OPTIMIZE_AWAY(FromString<ui32>(str1234, 4));
- }
-}
-
-Y_CPU_BENCHMARK(Parse_12345678, iface) {
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- Y_DO_NOT_OPTIMIZE_AWAY(FromString<ui32>(str12345678, 8));
- }
-}
-
-//atoi
-Y_CPU_BENCHMARK(Atoi_1, iface) {
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- Y_DO_NOT_OPTIMIZE_AWAY(atoi(str1));
- }
-}
-
-Y_CPU_BENCHMARK(Atoi_12, iface) {
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- Y_DO_NOT_OPTIMIZE_AWAY(atoi(str12));
- }
-}
-
-Y_CPU_BENCHMARK(Atoi_1234, iface) {
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- Y_DO_NOT_OPTIMIZE_AWAY(atoi(str1234));
- }
-}
-
-Y_CPU_BENCHMARK(Atoi_12345678, iface) {
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- Y_DO_NOT_OPTIMIZE_AWAY(atoi(str12345678));
- }
-}
diff --git a/util/string/benchmark/float_to_string/main.cpp b/util/string/benchmark/float_to_string/main.cpp
deleted file mode 100644
index 1c7c0684a3..0000000000
--- a/util/string/benchmark/float_to_string/main.cpp
+++ /dev/null
@@ -1,253 +0,0 @@
-#include <library/cpp/testing/benchmark/bench.h>
-
-#include <util/generic/singleton.h>
-#include <util/generic/vector.h>
-#include <util/generic/xrange.h>
-#include <util/generic/ymath.h>
-#include <util/random/fast.h>
-#include <util/string/cast.h>
-#include <util/string/printf.h>
-
-#include <limits>
-
-#include <cmath>
-
-/* Please be careful before making any decisions based on this benchmark.
- *
- * Only `Sprintf("%.<decimals>f", x)` and `FloatToString(x, PREC_POINT_DIGITS, decimals` produce
- * equal results in general case. However, results for cases when x \in [0, 1) must be equal for
- * both `Sprintf` and `FloatToString`.
- *
- * Read more about formatting in STL [1, 2] and Yandex Util formatting [3]
- *
- * [1] http://www.cplusplus.com/reference/cstdio/printf/
- * [2] http://en.cppreference.com/w/c/io/fprintf
- * [3] https://a.yandex-team.ru/arc/trunk/arcadia/util/string/cast.h?rev=2432660#L29
- */
-
-namespace {
- template <typename T>
- struct TExample {
- T Value{};
- int DigitsCount{};
- };
-
- template <typename T, size_t N>
- struct TExamplesHolder {
- TVector<TExample<T>> Examples;
-
- TExamplesHolder()
- : Examples(N)
- {
- TFastRng<ui64> prng{N * sizeof(T) * 42};
- for (auto& x : Examples) {
- x.Value = prng.GenRandReal4() + prng.Uniform(Max<ui16>());
- x.DigitsCount = prng.Uniform(std::numeric_limits<T>::max_digits10 + 1);
- }
- }
- };
-
- template <typename T, size_t N>
- struct TNearZeroExamplesHolder {
- TVector<TExample<T>> Examples;
-
- TNearZeroExamplesHolder()
- : Examples(N)
- {
- TFastRng<ui64> prng{N * sizeof(T) * 42};
- for (auto& x : Examples) {
- x.Value = prng.GenRandReal4();
- x.DigitsCount = prng.Uniform(std::numeric_limits<T>::max_digits10 + 1);
- }
- }
- };
-}
-
-static const char* FORMAT_FIXED[] = {
- "%.0f",
- "%.1f",
- "%.2f",
- "%.3f",
- "%.4f",
- "%.5f",
- "%.6f",
- "%.7f",
- "%.8f",
- "%.9f",
- "%.10f",
- "%.11f",
- "%.12f",
- "%.13f",
- "%.14f",
- "%.15f",
- "%.16f",
- "%.17f",
-};
-
-static const char* FORMAT_SIGNIFICANT[] = {
- "%.0g",
- "%.1g",
- "%.2g",
- "%.3g",
- "%.4g",
- "%.5g",
- "%.6g",
- "%.7g",
- "%.8g",
- "%.9g",
- "%.10g",
- "%.11g",
- "%.12g",
- "%.13g",
- "%.14g",
- "%.15g",
- "%.16g",
- "%.17g",
-};
-
-#define DEFINE_BENCHMARK(type, count) \
- Y_CPU_BENCHMARK(SprintfAuto_##type##_##count, iface) { \
- const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- for (const auto e : examples) { \
- /* this is in fact equal to Sprintf("%.6f", e.Value) and that is why it is faster */ \
- /* than FloatToString(e.Value) */ \
- Y_DO_NOT_OPTIMIZE_AWAY(Sprintf("%f", e.Value)); \
- } \
- } \
- } \
- \
- Y_CPU_BENCHMARK(FloatToStringAuto_##type##_##count, iface) { \
- const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- for (const auto e : examples) { \
- Y_DO_NOT_OPTIMIZE_AWAY(FloatToString(e.Value)); \
- } \
- } \
- } \
- \
- Y_CPU_BENCHMARK(SprintfFixed_##type##_##count, iface) { \
- const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- for (const auto e : examples) { \
- Y_DO_NOT_OPTIMIZE_AWAY(Sprintf(FORMAT_FIXED[e.DigitsCount], e.Value)); \
- } \
- } \
- } \
- \
- Y_CPU_BENCHMARK(FloatToStringFixed_##type##_##count, iface) { \
- const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- for (const auto e : examples) { \
- Y_DO_NOT_OPTIMIZE_AWAY(FloatToString(e.Value, PREC_NDIGITS, e.DigitsCount)); \
- } \
- } \
- } \
- \
- Y_CPU_BENCHMARK(SprintfSignificant_##type##_##count, iface) { \
- const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- for (const auto e : examples) { \
- Y_DO_NOT_OPTIMIZE_AWAY(Sprintf(FORMAT_SIGNIFICANT[e.DigitsCount], e.Value)); \
- } \
- } \
- } \
- \
- Y_CPU_BENCHMARK(FloatToStringSignificant_##type##_##count, iface) { \
- const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- for (const auto e : examples) { \
- Y_DO_NOT_OPTIMIZE_AWAY(FloatToString(e.Value, PREC_POINT_DIGITS, e.DigitsCount)); \
- } \
- } \
- } \
- \
- Y_CPU_BENCHMARK(NearZeroSprintfAuto_##type##_##count, iface) { \
- const auto& examples = Default<TNearZeroExamplesHolder<type, count>>().Examples; \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- for (const auto e : examples) { \
- /* this is in fact equal to Sprintf("%.6f", e.Value) and that is why it is faster */ \
- /* than FloatToString(e.Value) */ \
- Y_DO_NOT_OPTIMIZE_AWAY(Sprintf("%f", e.Value)); \
- } \
- } \
- } \
- \
- Y_CPU_BENCHMARK(NearZeroFloatToStringAuto_##type##_##count, iface) { \
- const auto& examples = Default<TNearZeroExamplesHolder<type, count>>().Examples; \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- for (const auto e : examples) { \
- Y_DO_NOT_OPTIMIZE_AWAY(FloatToString(e.Value)); \
- } \
- } \
- } \
- \
- Y_CPU_BENCHMARK(NearZeroSprintfFixed_##type##_##count, iface) { \
- const auto& examples = Default<TNearZeroExamplesHolder<type, count>>().Examples; \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- for (const auto e : examples) { \
- Y_DO_NOT_OPTIMIZE_AWAY(Sprintf(FORMAT_FIXED[e.DigitsCount], e.Value)); \
- } \
- } \
- } \
- \
- Y_CPU_BENCHMARK(NearZeroFloatToStringFixed_##type##_##count, iface) { \
- const auto& examples = Default<TNearZeroExamplesHolder<type, count>>().Examples; \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- for (const auto e : examples) { \
- Y_DO_NOT_OPTIMIZE_AWAY(FloatToString(e.Value, PREC_NDIGITS, e.DigitsCount)); \
- } \
- } \
- } \
- \
- Y_CPU_BENCHMARK(NearZeroSprintfSignificant_##type##_##count, iface) { \
- const auto& examples = Default<TNearZeroExamplesHolder<type, count>>().Examples; \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- for (const auto e : examples) { \
- Y_DO_NOT_OPTIMIZE_AWAY(Sprintf(FORMAT_SIGNIFICANT[e.DigitsCount], e.Value)); \
- } \
- } \
- } \
- \
- Y_CPU_BENCHMARK(NearZeroFloatToStringSignificant_##type##_##count, iface) { \
- const auto& examples = Default<TNearZeroExamplesHolder<type, count>>().Examples; \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- for (const auto e : examples) { \
- Y_DO_NOT_OPTIMIZE_AWAY(FloatToString(e.Value, PREC_POINT_DIGITS, e.DigitsCount)); \
- } \
- } \
- }
-
-DEFINE_BENCHMARK(float, 1);
-DEFINE_BENCHMARK(float, 2);
-DEFINE_BENCHMARK(float, 4);
-DEFINE_BENCHMARK(float, 8);
-DEFINE_BENCHMARK(float, 16);
-DEFINE_BENCHMARK(float, 32);
-DEFINE_BENCHMARK(float, 64);
-DEFINE_BENCHMARK(float, 128);
-DEFINE_BENCHMARK(float, 256);
-
-DEFINE_BENCHMARK(double, 1);
-DEFINE_BENCHMARK(double, 2);
-DEFINE_BENCHMARK(double, 4);
-DEFINE_BENCHMARK(double, 8);
-DEFINE_BENCHMARK(double, 16);
-DEFINE_BENCHMARK(double, 32);
-DEFINE_BENCHMARK(double, 64);
-DEFINE_BENCHMARK(double, 128);
-DEFINE_BENCHMARK(double, 256);
-
-#undef DEFINE_BENCHMARK
diff --git a/util/string/benchmark/float_to_string/metrics/main.py b/util/string/benchmark/float_to_string/metrics/main.py
deleted file mode 100644
index e9d4b7ac1d..0000000000
--- a/util/string/benchmark/float_to_string/metrics/main.py
+++ /dev/null
@@ -1,5 +0,0 @@
-import yatest.common as yc
-
-
-def test_export_metrics(metrics):
- metrics.set_benchmark(yc.execute_benchmark('util/string/benchmark/float_to_string/float_to_string', threads=8))
diff --git a/util/string/benchmark/join/main.cpp b/util/string/benchmark/join/main.cpp
deleted file mode 100644
index 1a8633d3a8..0000000000
--- a/util/string/benchmark/join/main.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-#include <library/cpp/testing/benchmark/bench.h>
-
-#include <util/generic/function.h>
-#include <util/generic/singleton.h>
-#include <util/generic/vector.h>
-#include <util/generic/xrange.h>
-#include <util/random/fast.h>
-#include <util/string/cast.h>
-#include <util/string/join.h>
-
-namespace {
- // This class assigns random values to variadic lists of variables of different types.
- // It can be used to randomize a tuple via Apply() (arcadia version of std::apply).
- class TRandomizer {
- public:
- TRandomizer(ui64 seed)
- : Prng(seed)
- {
- }
-
- void Randomize(ui16& i) {
- i = static_cast<ui16>(Prng.GenRand());
- }
-
- void Randomize(ui32& i) {
- i = static_cast<ui32>(Prng.GenRand());
- }
-
- void Randomize(double& d) {
- d = Prng.GenRandReal4() + Prng.Uniform(Max<ui16>());
- }
-
- void Randomize(TString& s) {
- s = ::ToString(Prng.GenRand());
- }
-
- template <typename T, typename... TArgs>
- void Randomize(T& t, TArgs&... args) {
- Randomize(t);
- Randomize(args...);
- }
-
- private:
- TFastRng<ui64> Prng;
- };
-
- template <size_t N, typename... T>
- struct TExamplesHolder {
- using TExamples = TVector<std::tuple<T...>>;
- TExamples Examples;
-
- TExamplesHolder()
- : Examples(N)
- {
- TRandomizer r{N * sizeof(typename TExamples::value_type) * 42};
- for (auto& x : Examples) {
- Apply([&r](T&... t) { r.Randomize(t...); }, x);
- }
- }
- };
-
- template <typename... TArgs>
- TString JoinTuple(std::tuple<TArgs...> t) {
- return Apply([](TArgs... x) -> TString { return Join("-", x...); }, t);
- }
-}
-
-#define DEFINE_BENCHMARK(count, types, ...) \
- Y_CPU_BENCHMARK(Join_##count##_##types, iface) { \
- const auto& examples = Default<TExamplesHolder<count, __VA_ARGS__>>().Examples; \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- for (const auto e : examples) { \
- Y_DO_NOT_OPTIMIZE_AWAY(JoinTuple(e)); \
- } \
- } \
- }
-
-DEFINE_BENCHMARK(100, SS, TString, TString);
-DEFINE_BENCHMARK(100, SSS, TString, TString, TString);
-DEFINE_BENCHMARK(100, SSSSS, TString, TString, TString, TString, TString);
-
-DEFINE_BENCHMARK(100, ss, ui16, ui16);
-DEFINE_BENCHMARK(100, SsS, TString, ui16, TString);
-DEFINE_BENCHMARK(100, SsSsS, TString, ui16, TString, ui16, TString);
-
-DEFINE_BENCHMARK(100, ii, ui32, ui32);
-DEFINE_BENCHMARK(100, SiS, TString, ui32, TString);
-DEFINE_BENCHMARK(100, SiSiS, TString, ui32, TString, ui32, TString);
-
-DEFINE_BENCHMARK(100, dd, double, double);
-DEFINE_BENCHMARK(100, SdS, TString, double, TString);
-DEFINE_BENCHMARK(100, SdSdS, TString, double, TString, double, TString);
-
-#undef DEFINE_BENCHMARK
diff --git a/util/string/benchmark/join/metrics/main.py b/util/string/benchmark/join/metrics/main.py
deleted file mode 100644
index 1ed5014808..0000000000
--- a/util/string/benchmark/join/metrics/main.py
+++ /dev/null
@@ -1,5 +0,0 @@
-import yatest.common as yc
-
-
-def test_export_metrics(metrics):
- metrics.set_benchmark(yc.execute_benchmark('util/string/benchmark/join/join', threads=8))
diff --git a/util/string/benchmark/strip/main.cpp b/util/string/benchmark/strip/main.cpp
deleted file mode 100644
index 35a266e4f4..0000000000
--- a/util/string/benchmark/strip/main.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-#include <library/cpp/testing/benchmark/bench.h>
-
-#include <util/string/strip.h>
-#include <util/generic/xrange.h>
-
-static const TString SHORT_STRING = " foo ";
-static const TString LONG_STRING = TString(200, ' ') + TString(200, 'f') + TString(200, ' ');
-
-Y_CPU_BENCHMARK(StripInPlaceShortNoChange, iface) {
- TString s = "foo";
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- StripInPlace(s);
- Y_DO_NOT_OPTIMIZE_AWAY(s);
- }
-}
-
-Y_CPU_BENCHMARK(StripInPlaceLongNoChange, iface) {
- TString s = TString{200, 'f'};
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- StripInPlace(s);
- Y_DO_NOT_OPTIMIZE_AWAY(s);
- }
-}
-
-Y_CPU_BENCHMARK(StripInPlaceShort, iface) {
- TString s;
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- s.assign(SHORT_STRING.begin(), SHORT_STRING.end());
- StripInPlace(s);
- Y_DO_NOT_OPTIMIZE_AWAY(s);
- }
-}
-
-Y_CPU_BENCHMARK(StripInPlaceLong, iface) {
- TString s;
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- s.assign(LONG_STRING.begin(), LONG_STRING.end());
- StripInPlace(s);
- Y_DO_NOT_OPTIMIZE_AWAY(s);
- }
-}
-
-Y_CPU_BENCHMARK(StripInPlaceShortMut, iface) {
- TString s = SHORT_STRING;
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- s.append(' ');
- StripInPlace(s);
- Y_DO_NOT_OPTIMIZE_AWAY(s);
- }
-}
-
-Y_CPU_BENCHMARK(StripInPlaceLongMut, iface) {
- TString s = LONG_STRING;
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- s.append(100, ' ');
- StripInPlace(s);
- Y_DO_NOT_OPTIMIZE_AWAY(s);
- }
-}
diff --git a/util/string/benchmark/subst_global/main.cpp b/util/string/benchmark/subst_global/main.cpp
deleted file mode 100644
index e0decfa042..0000000000
--- a/util/string/benchmark/subst_global/main.cpp
+++ /dev/null
@@ -1,203 +0,0 @@
-#include <library/cpp/testing/benchmark/bench.h>
-
-#include <util/generic/cast.h>
-#include <util/generic/singleton.h>
-#include <util/generic/string.h>
-#include <util/generic/xrange.h>
-#include <util/random/fast.h>
-#include <util/string/cast.h>
-#include <util/string/subst.h>
-
-namespace {
- template <size_t N, char What, char With>
- struct TNoMatches {
- enum : char {
- WHAT = What,
- WITH = With
- };
- TString Str;
-
- TNoMatches() {
- for (const auto dummy : xrange(N)) {
- Y_UNUSED(dummy);
- Str += WHAT + 1;
- }
- }
- };
-
- template <size_t N, char What, char With>
- struct TOneMatchInTheBeginning {
- enum : char {
- WHAT = What,
- WITH = With
- };
- TString Str;
-
- TOneMatchInTheBeginning() {
- if (!N) {
- return;
- }
-
- Str += WHAT;
- if (N > 1) {
- for (const auto dummy : xrange(N - 1)) {
- Y_UNUSED(dummy);
- Str += WHAT + 1;
- }
- }
- }
- };
-
- template <size_t N, char What, char With>
- struct TOneMatchInTheEnd {
- enum : char {
- WHAT = What,
- WITH = With
- };
- TString Str;
-
- TOneMatchInTheEnd() {
- if (!N) {
- return;
- }
-
- if (N > 1) {
- for (const auto dummy : xrange(N - 1)) {
- Y_UNUSED(dummy);
- Str += WHAT + 1;
- }
- }
- Str += WHAT;
- }
- };
-
- template <size_t N, char What, char With>
- struct TOneMatchInTheMiddle {
- enum : char {
- WHAT = What,
- WITH = With
- };
- TString Str;
-
- TOneMatchInTheMiddle() {
- if (!N) {
- return;
- }
-
- for (size_t i = 0; i < N / 2; ++i) {
- Str += WHAT + 1;
- }
- Str += WHAT;
- for (; Str.size() < N;) {
- Str += WHAT + 1;
- }
- }
- };
-
- template <size_t N, char What, char With>
- struct TFirstHalfMatches {
- enum : char {
- WHAT = What,
- WITH = With
- };
- TString Str;
-
- TFirstHalfMatches() {
- for (size_t i = 0; i < N / 2; ++i) {
- Str += WHAT;
- }
- for (; Str.size() != N;) {
- Str += WHAT + 1;
- }
- }
- };
-
- template <size_t N, char What, char With>
- struct TSecondHalfMatches {
- enum : char {
- WHAT = What,
- WITH = With
- };
- TString Str;
-
- TSecondHalfMatches() {
- for (size_t i = 0; i < N / 2; ++i) {
- Str += WHAT + 1;
- }
- for (; Str.size() != N;) {
- Str += WHAT;
- }
- }
- };
-
- template <size_t N, size_t K, char What, char With>
- struct TEveryKth {
- enum : char {
- WHAT = What,
- WITH = With
- };
- TString Str;
-
- TEveryKth() {
- TFastRng<ui64> prng{N * K * 101};
- for (size_t i = 0; i < N; ++i) {
- Str += (prng() % K) ? (WHAT + 1) : WHAT;
- }
- }
- };
-}
-
-#define DEFINE_BENCHMARK(type, N) \
- Y_CPU_BENCHMARK(type##_##N, i) { \
- using D = T##type<N, 'a', 'z'>; \
- const auto& str = Default<D>().Str; \
- for (const auto dummy : xrange(i.Iterations())) { \
- Y_UNUSED(dummy); \
- auto s = str; \
- NBench::Escape(s.data()); \
- Y_DO_NOT_OPTIMIZE_AWAY(SubstGlobal(s, ToUnderlying(D::WHAT), ToUnderlying(D::WITH))); \
- NBench::Clobber(); \
- } \
- }
-
-#define DEFINE_RNG_BENCHMARK(N, K) \
- Y_CPU_BENCHMARK(Random_##N##_##K, i) { \
- using D = TEveryKth<N, K, 'a', 'z'>; \
- const auto& str = Default<D>().Str; \
- for (const auto dummy : xrange(i.Iterations())) { \
- Y_UNUSED(dummy); \
- auto s = str; \
- NBench::Escape(s.data()); \
- Y_DO_NOT_OPTIMIZE_AWAY(SubstGlobal(s, ToUnderlying(D::WHAT), ToUnderlying(D::WITH))); \
- NBench::Clobber(); \
- } \
- }
-
-DEFINE_BENCHMARK(NoMatches, 0)
-DEFINE_BENCHMARK(NoMatches, 1)
-DEFINE_BENCHMARK(NoMatches, 128)
-DEFINE_BENCHMARK(NoMatches, 4096)
-DEFINE_BENCHMARK(OneMatchInTheBeginning, 1)
-DEFINE_BENCHMARK(OneMatchInTheBeginning, 16)
-DEFINE_BENCHMARK(OneMatchInTheBeginning, 128)
-DEFINE_BENCHMARK(OneMatchInTheBeginning, 4096)
-DEFINE_BENCHMARK(OneMatchInTheEnd, 16)
-DEFINE_BENCHMARK(OneMatchInTheEnd, 128)
-DEFINE_BENCHMARK(OneMatchInTheEnd, 4096)
-DEFINE_BENCHMARK(OneMatchInTheMiddle, 16)
-DEFINE_BENCHMARK(OneMatchInTheMiddle, 128)
-DEFINE_BENCHMARK(OneMatchInTheMiddle, 4096)
-DEFINE_BENCHMARK(FirstHalfMatches, 16)
-DEFINE_BENCHMARK(FirstHalfMatches, 128)
-DEFINE_BENCHMARK(FirstHalfMatches, 4096)
-DEFINE_BENCHMARK(SecondHalfMatches, 16)
-DEFINE_BENCHMARK(SecondHalfMatches, 128)
-DEFINE_BENCHMARK(SecondHalfMatches, 4096)
-
-DEFINE_RNG_BENCHMARK(4096, 1)
-DEFINE_RNG_BENCHMARK(4096, 2)
-DEFINE_RNG_BENCHMARK(4096, 3)
-DEFINE_RNG_BENCHMARK(4096, 4)
-DEFINE_RNG_BENCHMARK(4096, 10)
-DEFINE_RNG_BENCHMARK(4096, 32)
-DEFINE_RNG_BENCHMARK(4096, 100)
diff --git a/util/string/benchmark/subst_global/metrics/main.py b/util/string/benchmark/subst_global/metrics/main.py
deleted file mode 100644
index 62f2f3d76d..0000000000
--- a/util/string/benchmark/subst_global/metrics/main.py
+++ /dev/null
@@ -1,5 +0,0 @@
-import yatest.common as yc
-
-
-def test_export_metrics(metrics):
- metrics.set_benchmark(yc.execute_benchmark('util/string/benchmark/subst_global/subst_global', threads=8))
diff --git a/util/string/cast.py b/util/string/cast.py
deleted file mode 100644
index 4787f6ef44..0000000000
--- a/util/string/cast.py
+++ /dev/null
@@ -1,27 +0,0 @@
-print 'static const ui8 SAFE_LENS[4][15] = {'
-
-
-def nb(n, b):
- if n == 0:
- return [0]
-
- digits = []
-
- while n:
- digits.append(int(n % b))
- n /= b
-
- return digits[::-1]
-
-
-for p in (1, 2, 4, 8):
-
- def it1():
- for base in range(2, 17):
- m = 2 ** (8 * p) - 1
-
- yield len(nb(m, base)) - 1
-
- print ' {0, 0, ' + ', '.join(str(x) for x in it1()) + '},'
-
-print '};'
diff --git a/util/string/fuzzing/collapse/main.cpp b/util/string/fuzzing/collapse/main.cpp
deleted file mode 100644
index e7b09f0f55..0000000000
--- a/util/string/fuzzing/collapse/main.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <util/string/strip.h>
-#include <util/charset/wide.h>
-
-extern "C" int LLVMFuzzerTestOneInput(const ui8* data, size_t size) {
- TUtf16String w((const wchar16*)data, size / 2);
- Collapse(w);
-
- TString s((const char*)data, size);
- CollapseInPlace(s);
-
- return 0; // Non-zero return values are reserved for future use.
-}
diff --git a/util/string/fuzzing/escape_c/main.cpp b/util/string/fuzzing/escape_c/main.cpp
deleted file mode 100644
index 742126416a..0000000000
--- a/util/string/fuzzing/escape_c/main.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <util/generic/string.h>
-#include <util/string/escape.h>
-
-extern "C" int LLVMFuzzerTestOneInput(const ui8* const data, const size_t size) {
- const TString src(reinterpret_cast<const char*>(data), size);
- const auto escaped = EscapeC(src);
- const auto dst = UnescapeC(escaped);
-
- Y_VERIFY(src == dst);
- return 0;
-}
diff --git a/util/string/fuzzing/strtod/main.cpp b/util/string/fuzzing/strtod/main.cpp
deleted file mode 100644
index 50ea2a6afc..0000000000
--- a/util/string/fuzzing/strtod/main.cpp
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <util/string/cast.h>
-
-extern "C" int LLVMFuzzerTestOneInput(const ui8* data, size_t size) {
- double res;
-
- TryFromString<double>((const char*)data, size, res);
-
- return 0; // Non-zero return values are reserved for future use.
-}
diff --git a/util/system/benchmark/cpu_id/main.cpp b/util/system/benchmark/cpu_id/main.cpp
deleted file mode 100644
index 8efe539983..0000000000
--- a/util/system/benchmark/cpu_id/main.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-#include <library/cpp/testing/benchmark/bench.h>
-
-#include <util/system/cpu_id.h>
-
-#include <util/generic/xrange.h>
-
-#define DEFINE_BENCHMARK_PAIR(name) \
- Y_CPU_BENCHMARK(Have##name, iface) { \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- Y_DO_NOT_OPTIMIZE_AWAY(NX86::Have##name()); \
- } \
- } \
- \
- Y_CPU_BENCHMARK(CachedHave##name, iface) { \
- for (const auto i : xrange(iface.Iterations())) { \
- Y_UNUSED(i); \
- Y_DO_NOT_OPTIMIZE_AWAY(NX86::CachedHave##name()); \
- } \
- }
-
-DEFINE_BENCHMARK_PAIR(SSE)
-DEFINE_BENCHMARK_PAIR(SSE2)
-DEFINE_BENCHMARK_PAIR(SSE3)
-DEFINE_BENCHMARK_PAIR(SSSE3)
-DEFINE_BENCHMARK_PAIR(SSE41)
-DEFINE_BENCHMARK_PAIR(SSE42)
-DEFINE_BENCHMARK_PAIR(POPCNT)
-DEFINE_BENCHMARK_PAIR(BMI1)
-DEFINE_BENCHMARK_PAIR(AES)
-DEFINE_BENCHMARK_PAIR(AVX)
-DEFINE_BENCHMARK_PAIR(AVX2)
-DEFINE_BENCHMARK_PAIR(AVX512F)
-DEFINE_BENCHMARK_PAIR(AVX512DQ)
-DEFINE_BENCHMARK_PAIR(AVX512IFMA)
-DEFINE_BENCHMARK_PAIR(AVX512PF)
-DEFINE_BENCHMARK_PAIR(AVX512ER)
-DEFINE_BENCHMARK_PAIR(AVX512CD)
-DEFINE_BENCHMARK_PAIR(AVX512BW)
-DEFINE_BENCHMARK_PAIR(AVX512VL)
-DEFINE_BENCHMARK_PAIR(AVX512VBMI)
-DEFINE_BENCHMARK_PAIR(PREFETCHWT1)
-DEFINE_BENCHMARK_PAIR(SHA)
-DEFINE_BENCHMARK_PAIR(ADX)
-DEFINE_BENCHMARK_PAIR(RDRAND)
-DEFINE_BENCHMARK_PAIR(RDSEED)
-DEFINE_BENCHMARK_PAIR(PCOMMIT)
-DEFINE_BENCHMARK_PAIR(CLFLUSHOPT)
-DEFINE_BENCHMARK_PAIR(CLWB)
-
-#undef DEFINE_BENCHMARK_PAIR
diff --git a/util/system/benchmark/cpu_id/metrics/main.py b/util/system/benchmark/cpu_id/metrics/main.py
deleted file mode 100644
index d9a86e825c..0000000000
--- a/util/system/benchmark/cpu_id/metrics/main.py
+++ /dev/null
@@ -1,5 +0,0 @@
-import yatest.common as yc
-
-
-def test_export_metrics(metrics):
- metrics.set_benchmark(yc.execute_benchmark('util/system/benchmark/cpu_id/cpu_id', threads=8))
diff --git a/util/system/benchmark/create_destroy_thread/main.cpp b/util/system/benchmark/create_destroy_thread/main.cpp
deleted file mode 100644
index 0ca2a9d96f..0000000000
--- a/util/system/benchmark/create_destroy_thread/main.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <library/cpp/testing/benchmark/bench.h>
-
-#include <util/system/thread.h>
-
-static void* DoNothing(void*) noexcept {
- return nullptr;
-}
-
-Y_CPU_BENCHMARK(CreateDestroyThread, iface) {
- for (size_t i = 0, iEnd = iface.Iterations(); i < iEnd; ++i) {
- NBench::Clobber();
- TThread t(&DoNothing, nullptr);
- Y_DO_NOT_OPTIMIZE_AWAY(t);
- NBench::Clobber();
- }
-}
-
-Y_CPU_BENCHMARK(CreateRunDestroyThread, iface) {
- for (size_t i = 0, iEnd = iface.Iterations(); i < iEnd; ++i) {
- NBench::Clobber();
- TThread t(&DoNothing, nullptr);
- t.Start();
- NBench::Escape(t.Join());
- NBench::Clobber();
- }
-}
diff --git a/util/system/benchmark/create_destroy_thread/metrics/main.py b/util/system/benchmark/create_destroy_thread/metrics/main.py
deleted file mode 100644
index 45564cda7f..0000000000
--- a/util/system/benchmark/create_destroy_thread/metrics/main.py
+++ /dev/null
@@ -1,7 +0,0 @@
-import yatest.common as yc
-
-
-def test_export_metrics(metrics):
- metrics.set_benchmark(
- yc.execute_benchmark('util/system/benchmark/create_destroy_thread/create_destroy_thread', threads=8)
- )
diff --git a/util/system/benchmark/rdtsc/main.cpp b/util/system/benchmark/rdtsc/main.cpp
deleted file mode 100644
index 8189d10f06..0000000000
--- a/util/system/benchmark/rdtsc/main.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-#include <library/cpp/testing/benchmark/bench.h>
-
-#include <util/system/datetime.h>
-#include <util/generic/xrange.h>
-
-Y_FORCE_INLINE ui64 GetCycleCountLinux() {
- unsigned hi, lo;
- __asm__ __volatile__("lfence\n"
- "rdtsc"
- : "=a"(lo), "=d"(hi));
- return ((unsigned long long)lo) | (((unsigned long long)hi) << 32);
-}
-
-Y_FORCE_INLINE ui64 GetCycleCountAgri1() {
- unsigned hi, lo;
-
- __asm__ __volatile__("rdtscp\n"
- : "=a"(lo), "=d"(hi)::"%rbx", "%rcx");
-
- return ((unsigned long long)lo) | (((unsigned long long)hi) << 32);
-}
-
-Y_FORCE_INLINE ui64 GetCycleCountAgri2() {
- unsigned hi, lo;
- __asm__ __volatile__("rdtscp\n"
- : "=a"(lo), "=d"(hi)::"%rbx", "%rcx");
- /* call cpuid to prevent out of order execution */
- __asm__ __volatile__("mov $0, %%eax\n"
- "cpuid\n" ::
- : "%eax");
-
- return ((unsigned long long)lo) | (((unsigned long long)hi) << 32);
-}
-
-Y_CPU_BENCHMARK(RdtscUtil, iface) {
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- Y_DO_NOT_OPTIMIZE_AWAY(GetCycleCount());
- }
-}
-
-Y_CPU_BENCHMARK(RdtscLinux, iface) {
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- Y_DO_NOT_OPTIMIZE_AWAY(GetCycleCountLinux());
- }
-}
-
-Y_CPU_BENCHMARK(RdtscAgri1, iface) {
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- Y_DO_NOT_OPTIMIZE_AWAY(GetCycleCountAgri1());
- }
-}
-
-Y_CPU_BENCHMARK(RdtscAgri2, iface) {
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
- Y_DO_NOT_OPTIMIZE_AWAY(GetCycleCountAgri2());
- }
-}
diff --git a/util/system/context_aarch64.S b/util/system/context_aarch64.S
deleted file mode 100644
index 0b2ef4e4a6..0000000000
--- a/util/system/context_aarch64.S
+++ /dev/null
@@ -1,52 +0,0 @@
-.p2align 2
-#if !(defined __darwin__) && !(defined __arm64__)
-.global __mysetjmp
-.type __mysetjmp,@function
-__mysetjmp:
-#else
-.global ___mysetjmp
-___mysetjmp:
-#endif
- // IHI0055B_aapcs64.pdf 5.1.1, 5.1.2 callee saved registers
- stp x19, x20, [x0,#0]
- stp x21, x22, [x0,#16]
- stp x23, x24, [x0,#32]
- stp x25, x26, [x0,#48]
- stp x27, x28, [x0,#64]
- stp x29, x30, [x0,#80]
- mov x2, sp
- str x2, [x0,#104]
- stp d8, d9, [x0,#112]
- stp d10, d11, [x0,#128]
- stp d12, d13, [x0,#144]
- stp d14, d15, [x0,#160]
- mov x0, #0
- ret
-
-.p2align 2
-#if !(defined __darwin__) && !(defined __arm64__)
-.global __mylongjmp
-.type __mylongjump,@function
-__mylongjmp:
-#else
-.global ___mylongjmp
-___mylongjmp:
-#endif
- // IHI0055B_aapcs64.pdf 5.1.1, 5.1.2 callee saved registers
- ldp x19, x20, [x0,#0]
- ldp x21, x22, [x0,#16]
- ldp x23, x24, [x0,#32]
- ldp x25, x26, [x0,#48]
- ldp x27, x28, [x0,#64]
- ldp x29, x30, [x0,#80]
- ldr x2, [x0,#104]
- mov sp, x2
- ldp d8 , d9, [x0,#112]
- ldp d10, d11, [x0,#128]
- ldp d12, d13, [x0,#144]
- ldp d14, d15, [x0,#160]
-
- mov x0, x1
- cbnz x1, 1f
- mov x0, #1
-1: br x30
diff --git a/util/system/err.cpp b/util/system/err.cpp
deleted file mode 100644
index e2e5d8c9fd..0000000000
--- a/util/system/err.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-#include "defaults.h"
-#include "progname.h"
-#include "compat.h"
-#include "error.h"
-
-#include <util/generic/scope.h>
-
-#include <util/system/compat.h>
-#include <util/stream/printf.h>
-#include <util/stream/output.h>
-
-void vwarnx(const char* fmt, va_list args) {
- Cerr << GetProgramName() << ": ";
-
- if (fmt) {
- Printf(Cerr, fmt, args);
- }
-
- Cerr << '\n';
-}
-
-void vwarn(const char* fmt, va_list args) {
- int curErrNo = errno;
- auto curErrText = LastSystemErrorText();
-
- Y_DEFER {
- errno = curErrNo;
- };
-
- Cerr << GetProgramName() << ": ";
-
- if (fmt) {
- Printf(Cerr, fmt, args);
- Cerr << ": ";
- }
-
- Cerr << curErrText << '\n';
-}
-
-void warn(const char* fmt, ...) {
- va_list args;
-
- va_start(args, fmt);
- vwarn(fmt, args);
- va_end(args);
-}
-
-void warnx(const char* fmt, ...) {
- va_list args;
-
- va_start(args, fmt);
- vwarnx(fmt, args);
- va_end(args);
-}
-
-[[noreturn]] void verr(int status, const char* fmt, va_list args) {
- vwarn(fmt, args);
- std::exit(status);
-}
-
-[[noreturn]] void err(int status, const char* fmt, ...) {
- va_list args;
-
- va_start(args, fmt);
- verr(status, fmt, args);
- va_end(args);
-}
-
-[[noreturn]] void verrx(int status, const char* fmt, va_list args) {
- vwarnx(fmt, args);
- std::exit(status);
-}
-
-[[noreturn]] void errx(int status, const char* fmt, ...) {
- va_list args;
-
- va_start(args, fmt);
- verrx(status, fmt, args);
- va_end(args);
-}
diff --git a/util/system/fs_win.cpp b/util/system/fs_win.cpp
deleted file mode 100644
index 45d7454b2f..0000000000
--- a/util/system/fs_win.cpp
+++ /dev/null
@@ -1,255 +0,0 @@
-#include "fs_win.h"
-#include "defaults.h"
-#include "maxlen.h"
-
-#include <util/folder/dirut.h>
-#include <util/charset/wide.h>
-#include "file.h"
-
-#include <winioctl.h>
-
-namespace NFsPrivate {
- static LPCWSTR UTF8ToWCHAR(const TStringBuf str, TUtf16String& wstr) {
- wstr.resize(str.size());
- size_t written = 0;
- if (!UTF8ToWide(str.data(), str.size(), wstr.begin(), written))
- return nullptr;
- wstr.erase(written);
- static_assert(sizeof(WCHAR) == sizeof(wchar16), "expect sizeof(WCHAR) == sizeof(wchar16)");
- return (const WCHAR*)wstr.data();
- }
-
- static TString WCHARToUTF8(const LPWSTR wstr, size_t len) {
- static_assert(sizeof(WCHAR) == sizeof(wchar16), "expect sizeof(WCHAR) == sizeof(wchar16)");
-
- return WideToUTF8((wchar16*)wstr, len);
- }
-
- HANDLE CreateFileWithUtf8Name(const TStringBuf fName, ui32 accessMode, ui32 shareMode, ui32 createMode, ui32 attributes, bool inheritHandle) {
- TUtf16String wstr;
- LPCWSTR wname = UTF8ToWCHAR(fName, wstr);
- if (!wname) {
- ::SetLastError(ERROR_INVALID_NAME);
- return INVALID_HANDLE_VALUE;
- }
- SECURITY_ATTRIBUTES secAttrs;
- secAttrs.bInheritHandle = inheritHandle ? TRUE : FALSE;
- secAttrs.lpSecurityDescriptor = nullptr;
- secAttrs.nLength = sizeof(secAttrs);
- return ::CreateFileW(wname, accessMode, shareMode, &secAttrs, createMode, attributes, nullptr);
- }
-
- bool WinRename(const TString& oldPath, const TString& newPath) {
- TUtf16String op, np;
- LPCWSTR opPtr = UTF8ToWCHAR(oldPath, op);
- LPCWSTR npPtr = UTF8ToWCHAR(newPath, np);
- if (!opPtr || !npPtr) {
- ::SetLastError(ERROR_INVALID_NAME);
- return false;
- }
-
- return MoveFileExW(opPtr, npPtr, MOVEFILE_REPLACE_EXISTING) != 0;
- }
-
- bool WinRemove(const TString& path) {
- TUtf16String wstr;
- LPCWSTR wname = UTF8ToWCHAR(path, wstr);
- if (!wname) {
- ::SetLastError(ERROR_INVALID_NAME);
- return false;
- }
- WIN32_FILE_ATTRIBUTE_DATA fad;
- if (::GetFileAttributesExW(wname, GetFileExInfoStandard, &fad)) {
- if (fad.dwFileAttributes & FILE_ATTRIBUTE_READONLY) {
- fad.dwFileAttributes = FILE_ATTRIBUTE_NORMAL;
- ::SetFileAttributesW(wname, fad.dwFileAttributes);
- }
- if (fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
- return ::RemoveDirectoryW(wname) != 0;
- return ::DeleteFileW(wname) != 0;
- }
-
- return false;
- }
-
- bool WinSymLink(const TString& targetName, const TString& linkName) {
- TString tName(targetName);
- {
- size_t pos;
- while ((pos = tName.find('/')) != TString::npos)
- tName.replace(pos, 1, LOCSLASH_S);
- }
- TUtf16String tstr;
- LPCWSTR wname = UTF8ToWCHAR(tName, tstr);
- TUtf16String lstr;
- LPCWSTR lname = UTF8ToWCHAR(linkName, lstr);
-
- // we can't create a dangling link to a dir in this way
- ui32 attr = ::GetFileAttributesW(wname);
- if (attr == INVALID_FILE_ATTRIBUTES) {
- TTempBuf result;
- if (GetFullPathNameW(lname, result.Size(), (LPWSTR)result.Data(), 0) != 0) {
- TString fullPath = WideToUTF8(TWtringBuf((const wchar16*)result.Data()));
- TStringBuf linkDir(fullPath);
- linkDir.RNextTok('\\');
-
- if (linkDir) {
- TString fullTarget(tName);
- resolvepath(fullTarget, TString{linkDir});
- TUtf16String fullTargetW;
- LPCWSTR ptrFullTarget = UTF8ToWCHAR(fullTarget, fullTargetW);
- attr = ::GetFileAttributesW(ptrFullTarget);
- }
- }
- }
- return 0 != CreateSymbolicLinkW(lname, wname, attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY) ? SYMBOLIC_LINK_FLAG_DIRECTORY : 0);
- }
-
- bool WinHardLink(const TString& existingPath, const TString& newPath) {
- TUtf16String ep, np;
- LPCWSTR epPtr = UTF8ToWCHAR(existingPath, ep);
- LPCWSTR npPtr = UTF8ToWCHAR(newPath, np);
- if (!epPtr || !npPtr) {
- ::SetLastError(ERROR_INVALID_NAME);
- return false;
- }
-
- return (CreateHardLinkW(npPtr, epPtr, nullptr) != 0);
- }
-
- bool WinExists(const TString& path) {
- TUtf16String buf;
- LPCWSTR ptr = UTF8ToWCHAR(path, buf);
- return ::GetFileAttributesW(ptr) != INVALID_FILE_ATTRIBUTES;
- }
-
- TString WinCurrentWorkingDirectory() {
- TTempBuf result;
- LPWSTR buf = reinterpret_cast<LPWSTR>(result.Data());
- int r = GetCurrentDirectoryW(result.Size() / sizeof(WCHAR), buf);
- if (r == 0)
- throw TIoSystemError() << "failed to GetCurrentDirectory";
- return WCHARToUTF8(buf, r);
- }
-
- bool WinSetCurrentWorkingDirectory(const TString& path) {
- TUtf16String wstr;
- LPCWSTR wname = UTF8ToWCHAR(path, wstr);
- if (!wname) {
- ::SetLastError(ERROR_INVALID_NAME);
- return false;
- }
- return SetCurrentDirectoryW(wname);
- }
-
- bool WinMakeDirectory(const TString& path) {
- TUtf16String buf;
- LPCWSTR ptr = UTF8ToWCHAR(path, buf);
- return CreateDirectoryW(ptr, (LPSECURITY_ATTRIBUTES) nullptr);
- }
- // edited part of <Ntifs.h> from Windows DDK
-
-#define SYMLINK_FLAG_RELATIVE 1
-
- struct TReparseBufferHeader {
- USHORT SubstituteNameOffset;
- USHORT SubstituteNameLength;
- USHORT PrintNameOffset;
- USHORT PrintNameLength;
- };
-
- struct TSymbolicLinkReparseBuffer: public TReparseBufferHeader {
- ULONG Flags; // 0 or SYMLINK_FLAG_RELATIVE
- wchar16 PathBuffer[1];
- };
-
- struct TMountPointReparseBuffer: public TReparseBufferHeader {
- wchar16 PathBuffer[1];
- };
-
- struct TGenericReparseBuffer {
- wchar16 DataBuffer[1];
- };
-
- struct REPARSE_DATA_BUFFER {
- ULONG ReparseTag;
- USHORT ReparseDataLength;
- USHORT Reserved;
- union {
- TSymbolicLinkReparseBuffer SymbolicLinkReparseBuffer;
- TMountPointReparseBuffer MountPointReparseBuffer;
- TGenericReparseBuffer GenericReparseBuffer;
- };
- };
-
- // the end of edited part of <Ntifs.h>
-
- // For more info see:
- // * https://docs.microsoft.com/en-us/windows/win32/fileio/reparse-points
- // * https://docs.microsoft.com/en-us/windows-hardware/drivers/ifs/fsctl-get-reparse-point
- // * https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/ns-ntifs-_reparse_data_buffer
- REPARSE_DATA_BUFFER* ReadReparsePoint(HANDLE h, TTempBuf& buf) {
- while (true) {
- DWORD bytesReturned = 0;
- BOOL res = DeviceIoControl(h, FSCTL_GET_REPARSE_POINT, nullptr, 0, buf.Data(), buf.Size(), &bytesReturned, nullptr);
- if (res) {
- REPARSE_DATA_BUFFER* rdb = (REPARSE_DATA_BUFFER*)buf.Data();
- return rdb;
- } else {
- if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
- buf = TTempBuf(buf.Size() * 2);
- } else {
- return nullptr;
- }
- }
- }
- }
-
- TString WinReadLink(const TString& name) {
- TFileHandle h = CreateFileWithUtf8Name(name, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING,
- FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, true);
- TTempBuf buf;
- REPARSE_DATA_BUFFER* rdb = ReadReparsePoint(h, buf);
- if (rdb == nullptr) {
- ythrow TIoSystemError() << "can't read reparse point " << name;
- }
- if (rdb->ReparseTag == IO_REPARSE_TAG_SYMLINK) {
- wchar16* str = (wchar16*)&rdb->SymbolicLinkReparseBuffer.PathBuffer[rdb->SymbolicLinkReparseBuffer.SubstituteNameOffset / sizeof(wchar16)];
- size_t len = rdb->SymbolicLinkReparseBuffer.SubstituteNameLength / sizeof(wchar16);
- return WideToUTF8(str, len);
- } else if (rdb->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT) {
- wchar16* str = (wchar16*)&rdb->MountPointReparseBuffer.PathBuffer[rdb->MountPointReparseBuffer.SubstituteNameOffset / sizeof(wchar16)];
- size_t len = rdb->MountPointReparseBuffer.SubstituteNameLength / sizeof(wchar16);
- return WideToUTF8(str, len);
- }
- //this reparse point is unsupported in arcadia
- return TString();
- }
-
- ULONG WinReadReparseTag(HANDLE h) {
- TTempBuf buf;
- REPARSE_DATA_BUFFER* rdb = ReadReparsePoint(h, buf);
- return rdb ? rdb->ReparseTag : 0;
- }
-
- // we can't use this function to get an analog of unix inode due to a lot of NTFS folders do not have this GUID
- //(it will be 'create' case really)
- /*
-bool GetObjectId(const char* path, GUID* id) {
- TFileHandle h = CreateFileWithUtf8Name(path, 0, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT|FILE_FLAG_BACKUP_SEMANTICS, true);
- if (h.IsOpen()) {
- FILE_OBJECTID_BUFFER fob;
- DWORD resSize = 0;
- if (DeviceIoControl(h, FSCTL_CREATE_OR_GET_OBJECT_ID, nullptr, 0, &fob, sizeof(fob), &resSize, nullptr)) {
- Y_ASSERT(resSize == sizeof(fob));
- memcpy(id, &fob.ObjectId, sizeof(GUID));
- return true;
- }
- }
- memset(id, 0, sizeof(GUID));
- return false;
-}
-*/
-
-}
diff --git a/util/system/fs_win_ut.cpp b/util/system/fs_win_ut.cpp
deleted file mode 100644
index 46a8c5f2b0..0000000000
--- a/util/system/fs_win_ut.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-#include "fs.h"
-#include "fs_win.h"
-
-#include <library/cpp/testing/unittest/registar.h>
-
-#include "fileapi.h"
-
-#include "file.h"
-#include "fstat.h"
-#include "win_undef.h"
-#include <util/charset/wide.h>
-#include <util/folder/path.h>
-#include <util/generic/string.h>
-
-static void Touch(const TFsPath& path) {
- TFile file(path, CreateAlways | WrOnly);
- file.Write("1115", 4);
-}
-
-static LPCWSTR UTF8ToWCHAR(const TStringBuf str, TUtf16String& wstr) {
- wstr.resize(str.size());
- size_t written = 0;
- if (!UTF8ToWide(str.data(), str.size(), wstr.begin(), written))
- return nullptr;
- wstr.erase(written);
- static_assert(sizeof(WCHAR) == sizeof(wchar16), "expect sizeof(WCHAR) == sizeof(wchar16)");
- return (const WCHAR*)wstr.data();
-}
-
-Y_UNIT_TEST_SUITE(TFsWinTest) {
- Y_UNIT_TEST(TestRemoveDirWithROFiles) {
- TFsPath dir1 = "dir1";
- NFsPrivate::WinRemove(dir1);
- UNIT_ASSERT(!NFsPrivate::WinExists(dir1));
- UNIT_ASSERT(NFsPrivate::WinMakeDirectory(dir1));
-
- UNIT_ASSERT(TFileStat(dir1).IsDir());
- TFsPath file1 = dir1 / "file.txt";
- Touch(file1);
- UNIT_ASSERT(NFsPrivate::WinExists(file1));
- {
- TUtf16String wstr;
- LPCWSTR wname = UTF8ToWCHAR(static_cast<const TString&>(file1), wstr);
- UNIT_ASSERT(wname);
- WIN32_FILE_ATTRIBUTE_DATA fad;
- fad.dwFileAttributes = FILE_ATTRIBUTE_READONLY;
- ::SetFileAttributesW(wname, fad.dwFileAttributes);
- }
- NFsPrivate::WinRemove(dir1);
- UNIT_ASSERT(!NFsPrivate::WinExists(dir1));
- }
-
- Y_UNIT_TEST(TestRemoveReadOnlyDir) {
- TFsPath dir1 = "dir1";
- NFsPrivate::WinRemove(dir1);
- UNIT_ASSERT(!NFsPrivate::WinExists(dir1));
- UNIT_ASSERT(NFsPrivate::WinMakeDirectory(dir1));
-
- UNIT_ASSERT(TFileStat(dir1).IsDir());
- {
- TUtf16String wstr;
- LPCWSTR wname = UTF8ToWCHAR(static_cast<const TString&>(dir1), wstr);
- UNIT_ASSERT(wname);
- WIN32_FILE_ATTRIBUTE_DATA fad;
- fad.dwFileAttributes = FILE_ATTRIBUTE_READONLY;
- ::SetFileAttributesW(wname, fad.dwFileAttributes);
- }
- NFsPrivate::WinRemove(dir1);
- UNIT_ASSERT(!NFsPrivate::WinExists(dir1));
- }
-}
diff --git a/util/system/winint.cpp b/util/system/winint.cpp
deleted file mode 100644
index b13033bdee..0000000000
--- a/util/system/winint.cpp
+++ /dev/null
@@ -1 +0,0 @@
-#include "winint.h"
diff --git a/util/tests/sym_versions/test_glibc.py b/util/tests/sym_versions/test_glibc.py
deleted file mode 100644
index c76359c54c..0000000000
--- a/util/tests/sym_versions/test_glibc.py
+++ /dev/null
@@ -1,29 +0,0 @@
-import os
-import functools
-
-import yatest.common as yc
-import library.python.resource as lpr
-
-
-def construct_path(p):
- parts = p.split('/')
-
- return p + '/' + '-'.join(parts[-3:])
-
-
-def iter_binaries():
- ok = False
-
- for l in lpr.find('/test_binaries').split('\n'):
- if '# start' in l:
- ok = True
- else:
- if '# end' in l:
- ok = False
-
- if ok:
- yield construct_path(l.strip())
-
-
-for p in iter_binaries():
- globals()['test_' + os.path.basename(p).replace('-', '_')] = functools.partial(yc.process.check_glibc_version, p)