mirror of
https://github.com/facebook/rocksdb.git
synced 2024-11-29 18:33:58 +00:00
767777c2bd
Summary: We need to turn on -Wshorten-64-to-32 for mobile. See D1671432 (internal phabricator) for details. This diff turns on the warning flag and fixes all the errors. There were also some interesting errors that I might call bugs, especially in plain table. Going forward, I think it makes sense to have this flag turned on and be very very careful when converting 64-bit to 32-bit variables. Test Plan: compiles Reviewers: ljin, rven, yhchiang, sdong Reviewed By: yhchiang Subscribers: bobbaldwin, dhruba, leveldb Differential Revision: https://reviews.facebook.net/D28689
68 lines
1.4 KiB
C++
68 lines
1.4 KiB
C++
// Copyright (c) 2013, Facebook, Inc. All rights reserved.
|
|
// This source code is licensed under the BSD-style license found in the
|
|
// LICENSE file in the root directory of this source tree. An additional grant
|
|
// of patent rights can be found in the PATENTS file in the same directory.
|
|
//
|
|
|
|
#include "util/benchharness.h"
|
|
#include <vector>
|
|
|
|
namespace rocksdb {
|
|
|
|
BENCHMARK(insertFrontVector) {
|
|
std::vector<size_t> v;
|
|
for (size_t i = 0; i < 100; i++) {
|
|
v.insert(v.begin(), i);
|
|
}
|
|
}
|
|
|
|
BENCHMARK_RELATIVE(insertBackVector) {
|
|
std::vector<size_t> v;
|
|
for (size_t i = 0; i < 100; i++) {
|
|
v.insert(v.end(), i);
|
|
}
|
|
}
|
|
|
|
BENCHMARK_N(insertFrontVector_n, n) {
|
|
std::vector<size_t> v;
|
|
for (size_t i = 0; i < n; i++) {
|
|
v.insert(v.begin(), i);
|
|
}
|
|
}
|
|
|
|
BENCHMARK_RELATIVE_N(insertBackVector_n, n) {
|
|
std::vector<size_t> v;
|
|
for (size_t i = 0; i < n; i++) {
|
|
v.insert(v.end(), i);
|
|
}
|
|
}
|
|
|
|
BENCHMARK_N(insertFrontEnd_n, n) {
|
|
std::vector<size_t> v;
|
|
for (size_t i = 0; i < n; i++) {
|
|
v.insert(v.begin(), i);
|
|
}
|
|
for (size_t i = 0; i < n; i++) {
|
|
v.insert(v.end(), i);
|
|
}
|
|
}
|
|
|
|
BENCHMARK_RELATIVE_N(insertFrontEndSuspend_n, n) {
|
|
std::vector<size_t> v;
|
|
for (size_t i = 0; i < n; i++) {
|
|
v.insert(v.begin(), i);
|
|
}
|
|
BENCHMARK_SUSPEND {
|
|
for (size_t i = 0; i < n; i++) {
|
|
v.insert(v.end(), i);
|
|
}
|
|
}
|
|
}
|
|
|
|
} // namespace rocksdb
|
|
|
|
int main(int argc, char** argv) {
|
|
rocksdb::benchmark::RunBenchmarks();
|
|
return 0;
|
|
}
|