Files
firebase-ios-sdk/Firestore/Example/Benchmarks/FSTBenchmarkTests.mm
T
Gil bbc8de404c Add a benchmark for query execution (#4731)
* Use a valid project id

This avoids tripping up over newly added validation in the emulator

* Allow passing arguments to the emulator

e.g. to pass a non-default host

* Add a benchmark for reading documents

Baseline results:

Run on (12 X 2900 MHz CPU s)
CPU Caches:
  L1 Data 32K (x6)
  L1 Instruction 32K (x6)
  L2 Unified 262K (x6)
  L3 Unified 12582K (x1)
Load Average: 2.11, 1.96, 1.92
---------------------------------------------------------------------
Benchmark                           Time             CPU   Iterations
---------------------------------------------------------------------
BM_QueryMatching/0/1           168359 ns        13750 ns        53878
BM_QueryMatching/1/1           179118 ns        16706 ns        40193
BM_QueryMatching/1/10          721218 ns        35729 ns        10000
BM_QueryMatching/10/10         726533 ns        51864 ns        13587
BM_QueryMatching/1/100        5326040 ns        42820 ns         1000
BM_QueryMatching/100/100      5734101 ns       335289 ns         1000
BM_QueryMatching/1/1000      54110241 ns        41310 ns          100
BM_QueryMatching/10/1000     54584725 ns        95060 ns          100
BM_QueryMatching/100/1000    55083753 ns       527750 ns          100
BM_QueryMatching/1000/1000   58299823 ns        29130 ns          100
BM_QueryAll/1                  108892 ns        13355 ns        51197
BM_QueryAll/10                 657727 ns        43867 ns        10000
BM_QueryAll/100               5786091 ns       328244 ns         1000
BM_QueryAll/1000             60092767 ns        19380 ns          100

* Add a dedicated XCTest/Google Benchmark adapter

Remove FSTLevelDBBenchmarkTests. This benchmark appears to explore some
trade-off in document-size vs indexing but doesn't seem useful to
re-run.
2020-01-24 09:09:43 -08:00

47 lines
1.3 KiB
Plaintext

/*
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#import <Foundation/Foundation.h>
#import <XCTest/XCTest.h>
#include "benchmark/benchmark.h"
NS_ASSUME_NONNULL_BEGIN
/**
* An adapter for Google Benchmark that allows it to run as if it's an XCTest
* test case. This makes it possible to easily run those benchmarks on an iPhone
* directly from within Xcode.
*/
@interface FSTBenchmarkTests : XCTestCase
@end
@implementation FSTBenchmarkTests
- (void)testRunBenchmarks {
char* argv[] = {
const_cast<char*>("FSTBenchmarkTests"),
const_cast<char*>("--benchmark_filter=BM_.*"),
};
int argc = sizeof(argv) / sizeof(argv[0]);
benchmark::Initialize(&argc, argv);
benchmark::RunSpecifiedBenchmarks();
}
@end
NS_ASSUME_NONNULL_END