Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
53 lines (45 loc) · 1.58 KB

File metadata and controls

53 lines (45 loc) · 1.58 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "include/cppgc/allocation.h"
#include "include/cppgc/garbage-collected.h"
#include "include/cppgc/heap-consistency.h"
#include "src/base/macros.h"
#include "src/heap/cppgc/globals.h"
#include "src/heap/cppgc/heap.h"
#include "test/benchmarks/cpp/cppgc/utils.h"
#include "third_party/google_benchmark/src/include/benchmark/benchmark.h"
namespace cppgc {
namespace internal {
namespace {
using Allocate = testing::BenchmarkWithHeap;
class TinyObject final : public cppgc::GarbageCollected<TinyObject> {
public:
void Trace(cppgc::Visitor*) const {}
};
BENCHMARK_F(Allocate, Tiny)(benchmark::State& st) {
subtle::NoGarbageCollectionScope no_gc(*Heap::From(&heap()));
for (auto _ : st) {
USE(_);
benchmark::DoNotOptimize(
cppgc::MakeGarbageCollected<TinyObject>(heap().GetAllocationHandle()));
}
st.SetBytesProcessed(st.iterations() * sizeof(TinyObject));
}
class LargeObject final : public GarbageCollected<LargeObject> {
public:
void Trace(cppgc::Visitor*) const {}
char padding[kLargeObjectSizeThreshold + 1];
};
BENCHMARK_F(Allocate, Large)(benchmark::State& st) {
subtle::NoGarbageCollectionScope no_gc(*Heap::From(&heap()));
for (auto _ : st) {
USE(_);
benchmark::DoNotOptimize(
cppgc::MakeGarbageCollected<LargeObject>(heap().GetAllocationHandle()));
}
st.SetBytesProcessed(st.iterations() * sizeof(LargeObject));
}
} // namespace
} // namespace internal
} // namespace cppgc
Morty Proxy This is a proxified and sanitized view of the page, visit original site.