summaryrefslogtreecommitdiffstats
path: root/document/src/tests/base/documentid_benchmark.cpp
blob: 632c47507bd88754a4e27daa10bd1934fac05dfd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// 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>

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' %ld 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;
}