Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abseil-cpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
abseil-cpp
Commits
fbd5fa17
Commit
fbd5fa17
authored
Apr 02, 2024
by
Vitaly Goldshteyn
Committed by
Copybara-Service
Apr 02, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug in BM_EraseIf.
PiperOrigin-RevId: 621258501 Change-Id: Id094f3f0d0bc4a9fa8f3d1f90cfcd4c53beeb776
parent
5953a488
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
absl/container/internal/raw_hash_set_benchmark.cc
+6
-2
No files found.
absl/container/internal/raw_hash_set_benchmark.cc
View file @
fbd5fa17
...
...
@@ -17,6 +17,7 @@
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <numeric>
#include <random>
#include <string>
...
...
@@ -593,14 +594,17 @@ void BM_EraseIf(benchmark::State& state) {
auto
&
table
=
tables
.
back
();
for
(
int64_t
i
=
0
;
i
<
num_elements
;
i
++
)
{
// We use random keys to reduce noise.
k
.
push_back
(
absl
::
Uniform
<
int64_t
>
(
rng
,
0
,
~
int64_t
{}));
k
.
push_back
(
absl
::
Uniform
<
int64_t
>
(
rng
,
0
,
std
::
numeric_limits
<
int64_t
>::
max
()));
if
(
!
table
.
insert
(
k
.
back
()).
second
)
{
k
.
pop_back
();
--
i
;
// duplicated value, retrying
}
}
std
::
sort
(
k
.
begin
(),
k
.
end
());
threshold
.
push_back
(
k
[
num_erased
]);
threshold
.
push_back
(
static_cast
<
int64_t
>
(
num_erased
)
<
num_elements
?
k
[
num_erased
]
:
std
::
numeric_limits
<
int64_t
>::
max
());
}
while
(
state
.
KeepRunningBatch
(
static_cast
<
int64_t
>
(
kRepetitions
)
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment