Questions tagged [google-benchmark]

84 questions
2
votes
1 answer

Google benchmark state.PauseTiming() and state.ResumeTiming() take a long time

I am running some performance tests using google benchmark API. I use state.PauseTiming() and state.ResumeTiming() to avoid unnecessary code segments runs through perf path. I have attached the sample code below while (state.KeepRunning()) { …
Kethiri Sundar
  • 480
  • 2
  • 12
2
votes
0 answers

How to release the anonymous inode created by eventfd/eventpoll/timerfd?

I am trying to measure an API using Google Benchmark. It deals with the client/server code. The Google Benchmark application, runs the setUp() TearDown() pairs several times to measure the timing in an appropriate way. The client/server works over…
Boanerges
  • 476
  • 1
  • 5
  • 16
1
vote
1 answer

DoNotOptimize from google benchmark vs volatile keyword for optimising out

This is my benchmark code sample : Two ways of doing it : volatile result = compute(); 2nd way of doing it : bool result = compute(); DoNotOptimize(result); So i want to prevent the compiler to remove the compute() so which ones better ? Is it…
hft654
  • 51
  • 6
1
vote
2 answers

Can I calculate throughput via google benchmark library in C++

I want to measure how many times C++ function will be executed per N seconds, is there a way to do that via google benchmark? Maybe using some lambda for ComputeStatistics function? If there is no way to do it via google benchmark: are there any…
1
vote
0 answers

Why does my Google Benchmark result depend on the order of execution?

I am trying to benchmark the potential performance increase of emplace_back vs. push_back using Google Benchmark: #include #include #include using namespace std; static void BM_pushback(benchmark::State&…
Urwald
  • 343
  • 1
  • 10
1
vote
1 answer

LNK2001 linker error while linking google benchmark lib

I have a problem with linking benchmark.lib in my project. I've built it as described here. I've got sln file, compiled it (in release mode) and then created my own VS project. Linker can find my lib but it doesn't link it anyway (LNK2001). I added…
FlyIntFish
  • 31
  • 3
1
vote
1 answer

different behavior for different "for"s in benchmark

We can write a simple benchmark using google benchmark or https://www.quick-bench.com/, static void range_based_for(benchmark::State &state) { for (auto _ : state) { std::to_string(__LINE__); } } BENCHMARK(range_based_for); We can…
luckycpp
  • 11
  • 3
1
vote
0 answers

How to get the csv output file from google benchmark library and plot it?

I am using google benchmark library (https://github.com/google/benchmark/blob/main/docs/user_guide.md) to do time and complexity analysis of analgorithm in C++. I read that is possible to get an output file in csv or json format and then plot the…
Jay
  • 145
  • 2
  • 12
1
vote
0 answers

google benchmark performance of array and std::vector shows cpu time of array = 0ns? why

I use google benchmark test the performance of array and vector link: https://quick-bench.com/q/ixWRn2XG8Q1-OnSFP6GXsadsw_g and you can see the code with the link result: enter image description here it shows that use array is almost no cost, array…
崔志强
  • 11
  • 1
1
vote
1 answer

How to turn on multithread in Quick Bench?

Not sure if this is the right tag for this question. If not, please advice which is the right one. See this QuickBench example run here where there is no output when multithreading is…
visitor99999
  • 163
  • 1
  • 10
1
vote
1 answer

C++ - Google benchmark stop timing function

I'm trying to exclude the conversion of string into an object in a function. This is the involved function: std::vector> read_file(const std::string path, benchmark::State& state) { std::string kmer; …
th3g3ntl3man
  • 1,926
  • 5
  • 29
  • 50
1
vote
1 answer

Getting std::valarray to (google/quick) bench properly

I'm trying to compare the performance of using std::valarray vs. std::vector/std::transform operations using Google Bench. I'm using QuickBench. My code (for QuickBench) is #include class RG { public: double operator()() noexcept {…
JHBonarius
  • 10,824
  • 3
  • 22
  • 41
1
vote
1 answer

How should I properly represent multi-variable complexity with Google benchmark?

The Google microbenchmark library supports estimating complexity of an algorithm but everything is expressed by telling the framework what the size of your N is. I'm curious what the best way to represent M+N algorithms in this framework is. In my…
Vitali
  • 3,411
  • 2
  • 24
  • 25
1
vote
0 answers

Finding percentile latency in Google Benchmark

I am trying to benchmark Intel TBB bounded concurrent queue enqueue using Google benchmark. What I understand is that Google benchmark runs for n number of iterations till the latency becomes stable and returns the average timings. I want to find…
1
vote
1 answer

How to compile with clang a Google Benchmark using libc++

I would like to compile the example given in the Google Benchmark documentation with clang using libc++: #include static void BM_StringCreation(benchmark::State& state) { for (auto _ : state) std::string…
Pierre
  • 1,942
  • 3
  • 23
  • 43