Go to the source code of this file.
◆ run_pushpop()
Definition at line 91 of file GrMemoryPoolBench.cpp.
91 {
92 static const int kMaxObjects = 4 * (1 << 10);
94 for (
int i = 0;
i < loops; ++
i) {
95
96 for (int j = 0; j < kMaxObjects; ++j) {
98 objs[j] = (
T*)
pool->allocate(
sizeof(
T));
99 pool->release(objs[j]);
100 } else {
102 delete objs[j];
103 }
104 }
105
106
107 }
108}
◆ run_queue()
Definition at line 67 of file GrMemoryPoolBench.cpp.
67 {
68 static const int kMaxObjects = 4 * (1 << 10);
70 for (
int i = 0;
i < loops; ++
i) {
71
72 for (int j = 0; j < kMaxObjects; ++j) {
73 objs[j] =
pool ? (
T*)
pool->allocate(
sizeof(
T)) :
new T;
74 }
75
76 for (int j = 0; j < kMaxObjects; ++j) {
78 pool->release(objs[j]);
79 } else {
80 delete objs[j];
81 }
82 }
83
84
85 }
86}
◆ run_random()
Definition at line 112 of file GrMemoryPoolBench.cpp.
112 {
113 static const int kMaxObjects = 4 * (1 << 10);
114 T* objs[kMaxObjects];
115 for (
int i = 0;
i < kMaxObjects; ++
i) {
117 }
118
119 auto del = [&](int j) {
120
122 pool->release(objs[j]);
123 } else {
124 delete objs[j];
125 }
126 objs[j] = nullptr;
127 };
128
130 for (
int i = 0;
i < loops; ++
i) {
131
132
133 for (int j = 0; j < 2 * kMaxObjects; ++j) {
135 if (objs[k]) {
136 del(k);
137 } else {
138
139 objs[k] =
pool ? (
T*)
pool->allocate(
sizeof(
T)) :
new T;
140 }
141 }
142
143
144 for (int j = 0; j < kMaxObjects; ++j) {
145 if (objs[j]) {
146 del(j);
147 }
148 }
149 }
150}
uint32_t nextRangeU(uint32_t min, uint32_t max)
◆ run_stack()
Definition at line 43 of file GrMemoryPoolBench.cpp.
43 {
44 static const int kMaxObjects = 4 * (1 << 10);
46 for (
int i = 0;
i < loops; ++
i) {
47
48 for (int j = 0; j < kMaxObjects; ++j) {
49 objs[j] =
pool ? (
T*)
pool->allocate(
sizeof(
T)) :
new T;
50 }
51
52 for (int j = kMaxObjects - 1; j >= 0; --j) {
54 pool->release(objs[j]);
55 } else {
56 delete objs[j];
57 }
58 }
59
60
61 }
62}
◆ kLargePool
const int kLargePool = 10 * (1 << 10) |
|
static |
◆ kSmallPool