aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/benchmark/vector_count_ctor/f.cpp
blob: 19ddc48781ff12488d1adb6001a688ef2c3c65e3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#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();
    }
}