Skip to content

Commit 2e71873

Browse files
committed
Use RB::GetTempFS(), no need for extern static scratchDir
Also no need for RDataFrameBench.h anymore
1 parent 7c50a50 commit 2e71873

File tree

5 files changed

+17
-23
lines changed

5 files changed

+17
-23
lines changed

root/tree/dataframe/RDataFrameBench.h

Lines changed: 0 additions & 5 deletions
This file was deleted.

root/tree/dataframe/RDataFrameBenchmarks.cxx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#include "RDataFrameBench.h"
21
#include "ROOT/RDataFrame.hxx"
32
#include "TROOT.h" // ROOT::EnableImplicitMT
43
#include "TSystem.h" // TSystem::Unlink
@@ -10,8 +9,6 @@
109

1110
using namespace ROOT;
1211

13-
const std::string scratchDir = RB::GetTempFs();
14-
1512
static void BM_RDataFrame_CreateEmpty(benchmark::State &state)
1613
{
1714
for (auto _ : state)
@@ -21,7 +18,7 @@ BENCHMARK(BM_RDataFrame_CreateEmpty)->Unit(benchmark::kMicrosecond);
2118

2219
static void BM_RDataFrame_CreateFromFile(benchmark::State &state)
2320
{
24-
const auto fname = scratchDir + "/tdf_createfromfile.root";
21+
const auto fname = RB::GetTempFs() + "/tdf_createfromfile.root";
2522
const auto treeName = "t";
2623
RDataFrame(0).Snapshot<>(treeName, fname, {});
2724

@@ -79,7 +76,7 @@ BENCHMARK(BM_RDataFrame_NoOpLoop)->Unit(benchmark::kMicrosecond)->Arg(0)->Arg(1)
7976

8077
static void BM_RDataFrame_NoOpLoopOnFile(benchmark::State &state)
8178
{
82-
const auto fname = scratchDir + "/tdf_nooplooponfile" + std::to_string(state.range(0)) + ".root";
79+
const auto fname = RB::GetTempFs() + "/tdf_nooplooponfile" + std::to_string(state.range(0)) + ".root";
8380
const auto treeName = "t";
8481
RDataFrame(state.range(0)).Snapshot<>(treeName, fname, {});
8582

root/tree/dataframe/RDataFrameSumBenchmarks.cxx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#include "RDataFrameBench.h"
21
#include <ROOT/RDataFrame.hxx>
32
#include <ROOT/RVec.hxx>
43
#include <TFile.h>
@@ -14,17 +13,19 @@
1413
#include <vector>
1514
#include <cstring>
1615

16+
#include "rootbench/RBConfig.h"
17+
1718
using ROOT::RVec;
1819

1920
static constexpr auto treeName = "Events";
2021
static constexpr auto fileName = "data.root";
2122
static constexpr auto scalarBranch = "x";
2223
static constexpr auto vectorBranch = "vec";
2324
static constexpr auto nEntries = 100000;
24-
static const auto pathToFile = scratchDir + "/" + fileName;
25+
static const auto pathToFile = RB::GetTempFs() + "/" + fileName;
2526

2627

27-
void ensure(bool b)
28+
inline void ensure(bool b)
2829
{
2930
if (!b)
3031
std::abort();

root/tree/tree/TTreeBenchmarks.cxx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#include "RDataFrameBench.h"
21
#include <TFile.h>
32
#include <TSystem.h>
43
#include <TTree.h>
@@ -8,21 +7,17 @@
87
#include <vector>
98
#include "rootbench/RBConfig.h"
109

11-
const std::string scratchDir = RB::GetTempFs();
12-
1310
static constexpr auto treeName = "Events";
1411
static constexpr auto fileNameOneBranch = "dataonebranch.root";
1512
static constexpr auto fileNameTwoBranches = "datatwobranches.root";
1613
static constexpr auto branchOne = "x";
1714
static constexpr auto branchTwo = "y";
1815
static constexpr auto nEntries = 8000;
19-
static auto pathOneBranch = scratchDir + "/" + fileNameOneBranch;
20-
static auto pathTwoBranches = scratchDir + "/" + fileNameTwoBranches;
21-
22-
16+
static auto pathOneBranch = RB::GetTempFs() + "/" + fileNameOneBranch;
17+
static auto pathTwoBranches = RB::GetTempFs() + "/" + fileNameTwoBranches;
2318

2419
// an assert implementation that is not no-op for optimized builds
25-
void ensure(bool b)
20+
inline void ensure(bool b)
2621
{
2722
if (!b)
2823
std::abort();

root/tree/tree/TTreeSumBenchmarks.cxx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#include "RDataFrameBench.h"
21
#include <ROOT/RDataFrame.hxx>
32
#include <ROOT/RVec.hxx>
43
#include <TFile.h>
@@ -14,6 +13,13 @@
1413
#include <vector>
1514
#include <cstring>
1615

16+
#include "rootbench/RBConfig.h"
17+
18+
inline void ensure(bool b)
19+
{
20+
if (!b)
21+
std::abort();
22+
}
1723

1824
using ROOT::RVec;
1925

@@ -22,7 +28,7 @@ static constexpr auto fileName = "data.root";
2228
static constexpr auto scalarBranch = "x";
2329
static constexpr auto vectorBranch = "vec";
2430
static constexpr auto nEntries = 100000;
25-
static const auto pathToFile = scratchDir + "/" + fileName;
31+
static const auto pathToFile = RB::GetTempFs() + "/" + fileName;
2632

2733

2834
void MakeDataIfNeeded()

0 commit comments

Comments
 (0)