diff options
| author | vvvv <[email protected]> | 2025-10-09 12:25:18 +0300 |
|---|---|---|
| committer | vvvv <[email protected]> | 2025-10-09 12:57:17 +0300 |
| commit | cb77d014972b2cdb27d2e6d979fc3a2772b27ad4 (patch) | |
| tree | 7f3bcd8ce71c6bd0f3ccc11e31b9f665475b819e /yql/essentials/minikql/perf/alloc/alloc.cpp | |
| parent | d58a8990d353b051c27e1069141117fdfde64358 (diff) | |
YQL-20086 minikql
commit_hash:e96f7390db5fcbe7e9f64f898141a263ad522daa
Diffstat (limited to 'yql/essentials/minikql/perf/alloc/alloc.cpp')
| -rw-r--r-- | yql/essentials/minikql/perf/alloc/alloc.cpp | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/yql/essentials/minikql/perf/alloc/alloc.cpp b/yql/essentials/minikql/perf/alloc/alloc.cpp index 2d1d4129495..0fd29f3c1b9 100644 --- a/yql/essentials/minikql/perf/alloc/alloc.cpp +++ b/yql/essentials/minikql/perf/alloc/alloc.cpp @@ -7,28 +7,30 @@ using namespace NKikimr::NMiniKQL; using namespace NKikimr::NUdf; namespace { - inline void MyFree(const void* p, size_t) { return free(const_cast<void*>(p)); } - - template <void*(*Alloc)(ui64), void (*Free)(const void*,ui64)> - void Test(const TString& name) { - TSimpleTimer timer; - for (ui32 i = 0; i < 100000000; ++i) { - std::array<void*, 10> strs; - for (ui32 j = 0; j < strs.size(); ++j) { - void* p = Alloc(32); - *((volatile char*)p) = 0xff; - strs[j] = p; - } +inline void MyFree(const void* p, size_t) { + return free(const_cast<void*>(p)); +} - for (ui32 j = 0; j < strs.size(); ++j) { - void* p = strs[j]; - Free(p, 32); - } +template <void* (*Alloc)(ui64), void (*Free)(const void*, ui64)> +void Test(const TString& name) { + TSimpleTimer timer; + for (ui32 i = 0; i < 100000000; ++i) { + std::array<void*, 10> strs; + for (ui32 j = 0; j < strs.size(); ++j) { + void* p = Alloc(32); + *((volatile char*)p) = 0xff; + strs[j] = p; } - Cerr << "[" << name << "] Elapsed: " << timer.Get() << "\n"; + for (ui32 j = 0; j < strs.size(); ++j) { + void* p = strs[j]; + Free(p, 32); + } } + + Cerr << "[" << name << "] Elapsed: " << timer.Get() << "\n"; } +} // namespace int main(int, char**) { Test<&malloc, &MyFree>("malloc"); |
