summaryrefslogtreecommitdiffstats
path: root/document/src/tests/base/documentid_benchmark.cpp
blob: 7cfc880ba22f757a91c5a132b578351a961f71e3 (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 2017 Yahoo Holdings. 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], NULL, 0);
    printf("Creating documentid '%s' %" PRIu64 " times\n", s.c_str(), n);
    printf("sizeof(IdString)=%ld,  sizeof(IdIdString)=%ld\n", sizeof(IdString), sizeof(IdIdString));
    for (uint64_t i=0; i < n; i++) {
        IdString::UP id = IdString::createIdString(s);
        id.reset();
    }
    return 0;
}