Skip to content

Commit 36a7747

Browse files
authored
Merge 3693cb5 into 052ab22
2 parents 052ab22 + 3693cb5 commit 36a7747

File tree

1 file changed

+29
-15
lines changed

1 file changed

+29
-15
lines changed

ydb/core/tablet_flat/benchmark/b_part.cpp

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ namespace {
3737

3838
conf.WriteBTreeIndex = writeBTreeIndex;
3939

40-
conf.SliceSize = conf.Group(0).PageSize * 4;
41-
4240
return conf;
4341
}
4442

@@ -48,24 +46,33 @@ namespace {
4846
void SetUp(::benchmark::State& state)
4947
{
5048
const bool useBTree = state.range(0);
51-
const bool groups = state.range(1);
52-
const bool history = state.range(2);
49+
const ui32 partsCount = state.range(1);
50+
const bool groups = state.range(2);
51+
const bool history = state.range(3);
5352

5453
ui64 rows = history ? 300000 : 1000000;
5554
if (BENCHMARK_MAKE_LARGE_PART) {
5655
rows *= 10;
5756
}
5857
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);
58+
Subset = TMake(*Mass, PageConf(Mass->Model->Scheme->Families.size(), useBTree)).Mixed(0, partsCount, TMixerRnd(partsCount), history ? 0.7 : 0);
6059

60+
ui64 dataBytes = 0, dataPages = 0, indexBytes = 0;
61+
ui32 bTreeLevels = 0;
6162
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;
63+
dataBytes += part->Stat.Bytes;
64+
dataPages += IndexTools::CountMainPages(*part);
65+
indexBytes += part->IndexesRawSize;
6566
if (useBTree) {
66-
state.counters["Levels{0}"] = part->IndexPages.BTreeGroups[0].LevelCount;
67+
bTreeLevels = Max(bTreeLevels, part->IndexPages.BTreeGroups[0].LevelCount);
6768
}
6869
}
70+
state.counters["DataBytes"] = dataBytes;
71+
state.counters["DataPages"] = dataPages;
72+
state.counters["IndexBytes"] = indexBytes;
73+
if (useBTree) {
74+
state.counters["Levels{0}"] = bTreeLevels;
75+
}
6976

7077
if (history) {
7178
Checker = new TCheckIter(*Subset, {new TTestEnv()}, TRowVersion(0, 8));
@@ -150,7 +157,7 @@ BENCHMARK_DEFINE_F(TPartFixture, Prev)(benchmark::State& state) {
150157

151158
BENCHMARK_DEFINE_F(TPartFixture, SeekKey)(benchmark::State& state) {
152159
const bool useBTree = state.range(0);
153-
const ESeek seek = ESeek(state.range(3));
160+
const ESeek seek = ESeek(state.range(4));
154161

155162
TRowTool rowTool(*Subset->Scheme);
156163
auto tags = TVector<TTag>();
@@ -178,9 +185,9 @@ BENCHMARK_DEFINE_F(TPartFixture, SeekKey)(benchmark::State& state) {
178185
}
179186

180187
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);
188+
const bool reverse = state.range(4);
189+
const ESeek seek = static_cast<ESeek>(state.range(5));
190+
const ui32 items = state.range(6);
184191

185192
for (auto _ : state) {
186193
auto it = Mass->Saved.Any(Rnd);
@@ -200,8 +207,8 @@ BENCHMARK_DEFINE_F(TPartFixture, DoReads)(benchmark::State& state) {
200207
}
201208

202209
BENCHMARK_DEFINE_F(TPartFixture, DoCharge)(benchmark::State& state) {
203-
const bool reverse = state.range(3);
204-
const ui32 items = state.range(4);
210+
const bool reverse = state.range(4);
211+
const ui32 items = state.range(5);
205212

206213
auto tags = TVector<TTag>();
207214
for (auto c : Subset->Scheme->Cols) {
@@ -233,27 +240,31 @@ BENCHMARK_DEFINE_F(TPartFixture, BuildStats)(benchmark::State& state) {
233240
BENCHMARK_REGISTER_F(TPartFixture, SeekRowId)
234241
->ArgsProduct({
235242
/* b-tree */ {0, 1},
243+
/* parts */ {4},
236244
/* groups: */ {0, 1},
237245
/* history: */ {0}})
238246
->Unit(benchmark::kMicrosecond);
239247

240248
BENCHMARK_REGISTER_F(TPartFixture, Next)
241249
->ArgsProduct({
242250
/* b-tree */ {0, 1},
251+
/* parts */ {4},
243252
/* groups: */ {0, 1},
244253
/* history: */ {0}})
245254
->Unit(benchmark::kMicrosecond);
246255

247256
BENCHMARK_REGISTER_F(TPartFixture, Prev)
248257
->ArgsProduct({
249258
/* b-tree */ {0, 1},
259+
/* parts */ {4},
250260
/* groups: */ {0, 1},
251261
/* history: */ {0}})
252262
->Unit(benchmark::kMicrosecond);
253263

254264
BENCHMARK_REGISTER_F(TPartFixture, SeekKey)
255265
->ArgsProduct({
256266
/* b-tree */ {0, 1},
267+
/* parts */ {4},
257268
/* groups: */ {0, 1},
258269
/* history: */ {0},
259270
/* ESeek: */ {1}})
@@ -262,6 +273,7 @@ BENCHMARK_REGISTER_F(TPartFixture, SeekKey)
262273
BENCHMARK_REGISTER_F(TPartFixture, DoReads)
263274
->ArgsProduct({
264275
/* b-tree */ {0, 1},
276+
/* parts */ {4},
265277
/* groups: */ {1},
266278
/* history: */ {1},
267279
/* reverse: */ {0},
@@ -272,6 +284,7 @@ BENCHMARK_REGISTER_F(TPartFixture, DoReads)
272284
BENCHMARK_REGISTER_F(TPartFixture, DoCharge)
273285
->ArgsProduct({
274286
/* b-tree */ {0, 1},
287+
/* parts */ {4},
275288
/* groups: */ {1},
276289
/* history: */ {1},
277290
/* reverse: */ {0},
@@ -281,6 +294,7 @@ BENCHMARK_REGISTER_F(TPartFixture, DoCharge)
281294
BENCHMARK_REGISTER_F(TPartFixture, BuildStats)
282295
->ArgsProduct({
283296
/* b-tree */ {0, 1},
297+
/* parts */ {1, 4, 10},
284298
/* groups: */ {0, 1},
285299
/* history: */ {0, 1}})
286300
->Unit(benchmark::kMicrosecond);

0 commit comments

Comments
 (0)