aboutsummaryrefslogtreecommitdiffstats
path: root/document/src/tests/base/documentid_benchmark.cpp
blob: 7b5dc35b6e4494d88efdee42309228f0e95a5b3a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/document/base/documentid.h>
#include <cinttypes>

using namespace document;

int main(int argc, char *argv[])
{
    if (argc < 3) {
        fprintf(stderr, "Usage %s <docid> <count>\n", argv[0]);
    }
    vespalib::string s(argv[1]);
    uint64_t n = strtoul(argv[2], nullptr, 0);
    printf("Creating documentid '%s' %" PRIu64 " times\n", s.c_str(), n);
    printf("sizeof(IdString)=%ld,  sizeof(IdIdString)=%ld\n", sizeof(IdString), sizeof(IdString));
    for (uint64_t i=0; i < n; i++) {
        IdString id(s);
        (void) id;
    }
    return 0;
}