Project
Loading...
Searching...
No Matches
RepresentationBench.h File Reference

Per-call cost, memory and the synthetic boolean ladder: the measuring parts of the representation comparison. More...

#include "CADSupport/O2SolidHarness.h"
#include "TGeoBBox.h"
#include "TGeoBoolNode.h"
#include "TGeoCompositeShape.h"
#include "TGeoMatrix.h"
#include "TGeoShape.h"
#include "TGeoTube.h"
#include <algorithm>
#include <array>
#include <chrono>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <string>
#include <vector>

Go to the source code of this file.

Classes

struct  o2::cad::bench::TimingStat
 
struct  o2::cad::bench::MemorySnapshot
 
struct  o2::cad::bench::StructuralMemory
 
struct  o2::cad::bench::QuerySamples
 
struct  o2::cad::bench::detail::Lcg
 
struct  o2::cad::bench::BooleanTreeStats
 
class  o2::cad::bench::BallastShape
 

Namespaces

namespace  o2
 a couple of static helper functions to create timestamp values for CCDB queries or override obsolete objects
 
namespace  o2::cad
 
namespace  o2::cad::bench
 
namespace  o2::cad::bench::detail
 

Enumerations

enum class  o2::cad::bench::LadderShape { o2::cad::bench::Chain , o2::cad::bench::Balanced }
 

Functions

uint64_t o2::cad::bench::detail::mix (uint64_t acc, double value)
 
template<typename Pass >
TimingStat o2::cad::bench::timePasses (long long callsPerPass, int warmupPasses, int passes, Pass &&pass)
 
MemorySnapshot o2::cad::bench::readMemory ()
 
MemorySnapshot o2::cad::bench::operator- (const MemorySnapshot &a, const MemorySnapshot &b)
 
long long o2::cad::bench::fileBytes (const std::string &path)
 
QuerySamples o2::cad::bench::buildQuerySamples (const TGeoShape *reference, const std::string &referenceName, const Point3D &bboxMin, const Point3D &bboxMax, int nPoints, int nRays, uint64_t seed=20260802ULL, double inflate=0.12)
 
TimingStat o2::cad::bench::timeContainsPass (const TGeoShape *shape, const QuerySamples &s, int warmup, int passes)
 
TimingStat o2::cad::bench::timeSafetyPass (const TGeoShape *shape, const QuerySamples &s, int warmup, int passes)
 
TimingStat o2::cad::bench::timeDistOutPass (const TGeoShape *shape, const QuerySamples &s, int warmup, int passes)
 
TimingStat o2::cad::bench::timeDistInPass (const TGeoShape *shape, const QuerySamples &s, int warmup, int passes)
 
TGeoShape * o2::cad::bench::buildBooleanLadder (int leaves, LadderShape shape, const std::string &tag)
 
BooleanTreeStats o2::cad::bench::booleanTreeStats (const TGeoShape *shape)
 

Detailed Description

Per-call cost, memory and the synthetic boolean ladder: the measuring parts of the representation comparison.

Author
Sandro Wenzel sandr.nosp@m.o.we.nosp@m.nzel@.nosp@m.cern.nosp@m..ch
Since
2026-08

Header-only, and deliberately NOT in CADSupport, for the same reason XRayTransport.h is not: an instrument must not change the thing it measures. Nothing in the gate path or in libO2CADSupport is rebuilt differently because this file exists.

It is a header rather than code inside runXRayBenchmark.cxx so that the unit tests exercise THE SAME timing loop, THE SAME memory probe and THE SAME ladder the benchmark reports from. A test written against a second implementation of the same idea tests neither.

THREE THINGS THIS FILE IS CAREFUL ABOUT, each bought with a known way of getting it wrong:

  1. One wall clock is not a measurement. Every kernel is timed over several complete passes and reported as the MEDIAN with the min/max spread beside it, never as a single elapsed time. A single pass on a shared interactive machine is a sample of the machine's mood as much as of the kernel.
  2. The same questions, from the same sample sets, for every representation. The point and ray sets are built ONCE per part from a reference representation's own classification and handed unchanged to all three. Letting each representation partition its own inside/outside set would compare three different questions and call the answer a speed ratio.
  3. Two memory numbers, because they answer different questions. A STRUCTURAL count (exact, derived from the shape's own counters and element sizes) and a MEASURED resident/heap delta (noisy, allocator-dependent, but the only one that sees what the shape actually asked the allocator for). Where they disagree the structural one is the exact statement and the measured one is the honest one; both are printed.

Definition in file RepresentationBench.h.