17
17
#include < ydb/core/tablet_flat/test/libs/table/wrap_part.h>
18
18
#include < ydb/core/tablet_flat/test/libs/table/test_steps.h>
19
19
20
+ // ya test -r -D BENCHMARK_MAKE_LARGE_PART
20
21
#ifndef BENCHMARK_MAKE_LARGE_PART
21
22
#define BENCHMARK_MAKE_LARGE_PART 0
22
23
#endif
@@ -37,8 +38,6 @@ namespace {
37
38
38
39
conf.WriteBTreeIndex = writeBTreeIndex;
39
40
40
- conf.SliceSize = conf.Group (0 ).PageSize * 4 ;
41
-
42
41
return conf;
43
42
}
44
43
@@ -48,24 +47,33 @@ namespace {
48
47
void SetUp (::benchmark::State& state)
49
48
{
50
49
const bool useBTree = state.range (0 );
51
- const bool groups = state.range (1 );
52
- const bool history = state.range (2 );
50
+ const ui32 partsCount = state.range (1 );
51
+ const bool groups = state.range (2 );
52
+ const bool history = state.range (3 );
53
53
54
54
ui64 rows = history ? 300000 : 1000000 ;
55
55
if (BENCHMARK_MAKE_LARGE_PART) {
56
56
rows *= 10 ;
57
57
}
58
58
Mass = new NTest::TMass (new NTest::TModelStd (groups), rows);
59
- Subset = TMake (*Mass, PageConf (Mass->Model ->Scheme ->Families .size (), useBTree)).Mixed (0 , 1 , TMixerOne{ } , history ? 0.7 : 0 );
59
+ Subset = TMake (*Mass, PageConf (Mass->Model ->Scheme ->Families .size (), useBTree)).Mixed (0 , partsCount, TMixerRnd (partsCount) , history ? 0.7 : 0 );
60
60
61
+ ui64 dataBytes = 0 , dataPages = 0 , indexBytes = 0 ;
62
+ ui32 bTreeLevels = 0 ;
61
63
for (const auto & part : Subset->Flatten ) { // single part
62
- state. counters [ " DataBytes " ] = part->Stat .Bytes ;
63
- state. counters [ " DataPages " ] = IndexTools::CountMainPages (*part);
64
- state. counters [ " IndexBytes " ] = part->IndexesRawSize ;
64
+ dataBytes + = part->Stat .Bytes ;
65
+ dataPages + = IndexTools::CountMainPages (*part);
66
+ indexBytes + = part->IndexesRawSize ;
65
67
if (useBTree) {
66
- state. counters [ " Levels{0} " ] = part->IndexPages .BTreeGroups [0 ].LevelCount ;
68
+ bTreeLevels = Max (bTreeLevels, part->IndexPages .BTreeGroups [0 ].LevelCount ) ;
67
69
}
68
70
}
71
+ state.counters [" DataBytes" ] = dataBytes;
72
+ state.counters [" DataPages" ] = dataPages;
73
+ state.counters [" IndexBytes" ] = indexBytes;
74
+ if (useBTree) {
75
+ state.counters [" Levels{0}" ] = bTreeLevels;
76
+ }
69
77
70
78
if (history) {
71
79
Checker = new TCheckIter (*Subset, {new TTestEnv ()}, TRowVersion (0 , 8 ));
@@ -150,7 +158,7 @@ BENCHMARK_DEFINE_F(TPartFixture, Prev)(benchmark::State& state) {
150
158
151
159
BENCHMARK_DEFINE_F (TPartFixture, SeekKey)(benchmark::State& state) {
152
160
const bool useBTree = state.range (0 );
153
- const ESeek seek = ESeek (state.range (3 ));
161
+ const ESeek seek = ESeek (state.range (4 ));
154
162
155
163
TRowTool rowTool (*Subset->Scheme );
156
164
auto tags = TVector<TTag>();
@@ -178,9 +186,9 @@ BENCHMARK_DEFINE_F(TPartFixture, SeekKey)(benchmark::State& state) {
178
186
}
179
187
180
188
BENCHMARK_DEFINE_F (TPartFixture, DoReads)(benchmark::State& state) {
181
- const bool reverse = state.range (3 );
182
- const ESeek seek = static_cast <ESeek>(state.range (4 ));
183
- const ui32 items = state.range (5 );
189
+ const bool reverse = state.range (4 );
190
+ const ESeek seek = static_cast <ESeek>(state.range (5 ));
191
+ const ui32 items = state.range (6 );
184
192
185
193
for (auto _ : state) {
186
194
auto it = Mass->Saved .Any (Rnd);
@@ -200,8 +208,8 @@ BENCHMARK_DEFINE_F(TPartFixture, DoReads)(benchmark::State& state) {
200
208
}
201
209
202
210
BENCHMARK_DEFINE_F (TPartFixture, DoCharge)(benchmark::State& state) {
203
- const bool reverse = state.range (3 );
204
- const ui32 items = state.range (4 );
211
+ const bool reverse = state.range (4 );
212
+ const ui32 items = state.range (5 );
205
213
206
214
auto tags = TVector<TTag>();
207
215
for (auto c : Subset->Scheme ->Cols ) {
@@ -226,34 +234,38 @@ BENCHMARK_DEFINE_F(TPartFixture, DoCharge)(benchmark::State& state) {
226
234
BENCHMARK_DEFINE_F (TPartFixture, BuildStats)(benchmark::State& state) {
227
235
for (auto _ : state) {
228
236
TStats stats;
229
- BuildStats (*Subset, stats, NDataShard::gDbStatsRowCountResolution , NDataShard::gDbStatsDataSizeResolution , &Env, [](){});
237
+ BuildStats (*Subset, stats, NDataShard::gDbStatsRowCountResolution , NDataShard::gDbStatsDataSizeResolution , NDataShard:: gDbStatsHistogramBucketsCount , &Env, [](){});
230
238
}
231
239
}
232
240
233
241
BENCHMARK_REGISTER_F (TPartFixture, SeekRowId)
234
242
->ArgsProduct ({
235
243
/* b-tree */ {0 , 1 },
244
+ /* parts */ {4 },
236
245
/* groups: */ {0 , 1 },
237
246
/* history: */ {0 }})
238
247
->Unit(benchmark::kMicrosecond );
239
248
240
249
BENCHMARK_REGISTER_F (TPartFixture, Next)
241
250
->ArgsProduct ({
242
251
/* b-tree */ {0 , 1 },
252
+ /* parts */ {4 },
243
253
/* groups: */ {0 , 1 },
244
254
/* history: */ {0 }})
245
255
->Unit(benchmark::kMicrosecond );
246
256
247
257
BENCHMARK_REGISTER_F (TPartFixture, Prev)
248
258
->ArgsProduct ({
249
259
/* b-tree */ {0 , 1 },
260
+ /* parts */ {4 },
250
261
/* groups: */ {0 , 1 },
251
262
/* history: */ {0 }})
252
263
->Unit(benchmark::kMicrosecond );
253
264
254
265
BENCHMARK_REGISTER_F (TPartFixture, SeekKey)
255
266
->ArgsProduct ({
256
267
/* b-tree */ {0 , 1 },
268
+ /* parts */ {4 },
257
269
/* groups: */ {0 , 1 },
258
270
/* history: */ {0 },
259
271
/* ESeek: */ {1 }})
@@ -262,6 +274,7 @@ BENCHMARK_REGISTER_F(TPartFixture, SeekKey)
262
274
BENCHMARK_REGISTER_F (TPartFixture, DoReads)
263
275
->ArgsProduct ({
264
276
/* b-tree */ {0 , 1 },
277
+ /* parts */ {4 },
265
278
/* groups: */ {1 },
266
279
/* history: */ {1 },
267
280
/* reverse: */ {0 },
@@ -272,6 +285,7 @@ BENCHMARK_REGISTER_F(TPartFixture, DoReads)
272
285
BENCHMARK_REGISTER_F (TPartFixture, DoCharge)
273
286
->ArgsProduct ({
274
287
/* b-tree */ {0 , 1 },
288
+ /* parts */ {4 },
275
289
/* groups: */ {1 },
276
290
/* history: */ {1 },
277
291
/* reverse: */ {0 },
@@ -281,6 +295,7 @@ BENCHMARK_REGISTER_F(TPartFixture, DoCharge)
281
295
BENCHMARK_REGISTER_F (TPartFixture, BuildStats)
282
296
->ArgsProduct ({
283
297
/* b-tree */ {0 , 1 },
298
+ /* parts */ {1 , 4 , 10 },
284
299
/* groups: */ {0 , 1 },
285
300
/* history: */ {0 , 1 }})
286
301
->Unit(benchmark::kMicrosecond );
0 commit comments