Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
DigitalInBlue committed Feb 27, 2021
2 parents 4d96b25 + 577adb6 commit ee16f37
Show file tree
Hide file tree
Showing 14 changed files with 150 additions and 155 deletions.
22 changes: 9 additions & 13 deletions experiments/DemoTransform/DemoTransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,11 @@ constexpr int Multiple = 2112;
class DemoTransformFixture : public celero::TestFixture
{
public:

DemoTransformFixture()
{
}

virtual std::vector<celero::TestFixture::ExperimentValue> getExperimentValues() const override
std::vector<celero::TestFixture::ExperimentValue> getExperimentValues() const override
{
std::vector<celero::TestFixture::ExperimentValue> problemSpaceValues;

Expand All @@ -68,7 +67,7 @@ class DemoTransformFixture : public celero::TestFixture
}

/// Before each run, build a vector of random integers.
virtual void setUp(const celero::TestFixture::ExperimentValue& experimentValue) override
void setUp(const celero::TestFixture::ExperimentValue& experimentValue) override
{
this->arraySize = static_cast<int>(experimentValue.Value);

Expand All @@ -81,7 +80,7 @@ class DemoTransformFixture : public celero::TestFixture
}

/// After each run, clear the vector of random integers.
virtual void tearDown() override
void tearDown() override
{
this->arrayIn.clear();
this->arrayOut.clear();
Expand All @@ -102,18 +101,17 @@ BASELINE_F(DemoTransform, ForLoop, DemoTransformFixture, 30, 10000)
}

BASELINE_FIXED_F(DemoTransform, FixedTime, DemoTransformFixture, 1, 100)
{ }
{
}

BENCHMARK_F(DemoTransform, StdTransform, DemoTransformFixture, 30, 10000)
{
std::transform(this->arrayIn.begin(), this->arrayIn.end(), this->arrayOut.begin(),
std::bind1st(std::multiplies<int>(), Multiple));
std::transform(this->arrayIn.begin(), this->arrayIn.end(), this->arrayOut.begin(), std::bind1st(std::multiplies<int>(), Multiple));
}

BENCHMARK_F(DemoTransform, StdTransformLambda, DemoTransformFixture, 30, 10000)
{
std::transform(this->arrayIn.begin(), this->arrayIn.end(), this->arrayOut.begin(),
[](int in) -> int { return in * Multiple; });
std::transform(this->arrayIn.begin(), this->arrayIn.end(), this->arrayOut.begin(), [](int in) -> int { return in * Multiple; });
}

BENCHMARK_F(DemoTransform, SelfForLoop, DemoTransformFixture, 30, 10000)
Expand All @@ -126,12 +124,10 @@ BENCHMARK_F(DemoTransform, SelfForLoop, DemoTransformFixture, 30, 10000)

BENCHMARK_F(DemoTransform, SelfStdTransform, DemoTransformFixture, 30, 10000)
{
std::transform(this->arrayIn.begin(), this->arrayIn.end(), this->arrayIn.begin(),
std::bind1st(std::multiplies<int>(), Multiple));
std::transform(this->arrayIn.begin(), this->arrayIn.end(), this->arrayIn.begin(), std::bind1st(std::multiplies<int>(), Multiple));
}

BENCHMARK_F(DemoTransform, SelfStdTransformLambda, DemoTransformFixture, 30, 10000)
{
std::transform(this->arrayIn.begin(), this->arrayIn.end(), this->arrayIn.begin(),
[](int in) -> int { return in * Multiple; });
std::transform(this->arrayIn.begin(), this->arrayIn.end(), this->arrayIn.begin(), [](int in) -> int { return in * Multiple; });
}
32 changes: 14 additions & 18 deletions experiments/ExperimentCompressBools/ExperimentCompressBools.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
// Original code at: https://github.com/fenbf/benchmarkLibsTest

#pragma warning(push)
#pragma warning(disable : 4251) // warning C4251: celero::Result::pimpl': class 'celero::Pimpl<celero::Result::Impl>' needs to have dll-interface to
// be used by clients of class 'celero::Result'
#include <celero\Celero.h>
#pragma warning(pop)

#include <emmintrin.h>
#include <omp.h>

#include <array>
#include <bitset>
#include <iostream>
Expand Down Expand Up @@ -53,7 +49,7 @@ class MyExperimentValue : public celero::TestFixture::ExperimentValue
class CompressBoolsFixture : public celero::TestFixture
{
public:
virtual std::vector<celero::TestFixture::ExperimentValue> getExperimentValues() const override
std::vector<celero::TestFixture::ExperimentValue> getExperimentValues() const override
{
std::vector<celero::TestFixture::ExperimentValue> problemSpace;

Expand All @@ -75,7 +71,7 @@ class CompressBoolsFixture : public celero::TestFixture
}

/// Before each run, build a vector of random integers.
virtual void setUp(const celero::TestFixture::ExperimentValue& experimentValue) override
void setUp(const celero::TestFixture::ExperimentValue& experimentValue) override
{
this->arrayLength = static_cast<size_t>(experimentValue.Value);
this->inputValues.reset(new int[arrayLength]);
Expand Down Expand Up @@ -108,13 +104,13 @@ class CompressBoolsFixture : public celero::TestFixture
class NoPackingFixture : public CompressBoolsFixture
{
public:
virtual void setUp(const celero::TestFixture::ExperimentValue& x) override
void setUp(const celero::TestFixture::ExperimentValue& x) override
{
CompressBoolsFixture::setUp(x);
this->outputValues.reset(new bool[static_cast<unsigned int>(arrayLength)]);
}

virtual void tearDown() override
void tearDown() override
{
for(size_t i = 0; i < arrayLength; ++i)
{
Expand All @@ -136,7 +132,7 @@ BASELINE_F(CompressBoolsTest, NoPackingVersion, NoPackingFixture, SamplesCount,
class StdBitsetFixture : public CompressBoolsFixture
{
public:
virtual void tearDown() override
void tearDown() override
{
for(size_t i = 0; i < this->arrayLength; ++i)
{
Expand All @@ -160,13 +156,13 @@ BENCHMARK_F(CompressBoolsTest, StdBitset, StdBitsetFixture, SamplesCount, Iterat
class StdVectorFixture : public CompressBoolsFixture
{
public:
virtual void setUp(const celero::TestFixture::ExperimentValue& experimentValue) override
void setUp(const celero::TestFixture::ExperimentValue& experimentValue) override
{
CompressBoolsFixture::setUp(experimentValue);
this->outputVector.resize(static_cast<unsigned int>(experimentValue.Value));
}

virtual void tearDown() override
void tearDown() override
{
for(size_t i = 0; i < arrayLength; ++i)
{
Expand All @@ -192,7 +188,7 @@ class ManualVersionFixture : public CompressBoolsFixture
{
}

virtual void setUp(const celero::TestFixture::ExperimentValue& experimentValue) override
void setUp(const celero::TestFixture::ExperimentValue& experimentValue) override
{
CompressBoolsFixture::setUp(experimentValue);

Expand All @@ -202,7 +198,7 @@ class ManualVersionFixture : public CompressBoolsFixture
this->outputValues.reset(new uint8_t[this->numBytes]);
}

virtual void tearDown() override
void tearDown() override
{
for(size_t i = 0; i < this->arrayLength; ++i)
{
Expand Down Expand Up @@ -311,7 +307,7 @@ struct bool8
class PackedStructFixture : public CompressBoolsFixture
{
public:
virtual void setUp(const celero::TestFixture::ExperimentValue& experimentValue) override
void setUp(const celero::TestFixture::ExperimentValue& experimentValue) override
{
CompressBoolsFixture::setUp(experimentValue);

Expand All @@ -320,7 +316,7 @@ class PackedStructFixture : public CompressBoolsFixture
this->outputValues.reset(new bool8[numBytes]);
}

virtual void tearDown() override
void tearDown() override
{
for(size_t i = 0; i < arrayLength; ++i)
{
Expand Down Expand Up @@ -467,7 +463,7 @@ BENCHMARK_F(CompressBoolsTest, WithOpenMP, ManualVersionFixture, SamplesCount, I
class SimdVersionFixture : public CompressBoolsFixture
{
public:
virtual void setUp(const celero::TestFixture::ExperimentValue& experimentValue) override
void setUp(const celero::TestFixture::ExperimentValue& experimentValue) override
{
CompressBoolsFixture::setUp(experimentValue);

Expand All @@ -482,7 +478,7 @@ class SimdVersionFixture : public CompressBoolsFixture
}
}

virtual void tearDown() override
void tearDown() override
{
for(size_t i = 0; i < this->arrayLength; ++i)
{
Expand Down
8 changes: 1 addition & 7 deletions experiments/ExperimentCostSharedPtr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,17 @@
#
SET(PROJECT_NAME CeleroExperiment-CostOfSharedPtr)

#
# Add Header Files
#
set(TARGET_H
)

#
# Add Sources
#
set(TARGET_SRC
ExperimentCostOfSharedPtr.cpp
osg_ref_ptr.h
)

# Broiler Plate: Assign the src and headers to the executable.
add_executable(${PROJECT_NAME}
${TARGET_SRC}
${TARGET_H}
)

# Broiler Plate: Celero Project Dependencies
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#include <celero/Celero.h>
#include <celero/Utilities.h>

#include "osg_ref_ptr.h"

#include <array>
#include <chrono>
#include <thread>

#include "osg_ref_ptr.h"

///
/// This is the main(int argc, char** argv) for the entire celero program.
/// You can write your own, or use this macro to insert the standard one into the project.
Expand Down
11 changes: 6 additions & 5 deletions experiments/ExperimentParticles/ExperimentParticles.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
// Original code at: https://github.com/fenbf/benchmarkLibsTest

#include <celero/Celero.h>

#include "Particles.h"

CELERO_MAIN;

class ParticlesFixture : public celero::TestFixture
{
public:
virtual std::vector<celero::TestFixture::ExperimentValue> getExperimentValues() const override
std::vector<celero::TestFixture::ExperimentValue> getExperimentValues() const override
{
std::vector<celero::TestFixture::ExperimentValue> problemSpace;
const auto totalNumberOfTests = 10;
Expand All @@ -28,7 +29,7 @@ class ParticlesObjVectorFixture : public ParticlesFixture
{
public:
/// Before each run, build a vector of random integers.
virtual void setUp(const celero::TestFixture::ExperimentValue& x) override
void setUp(const celero::TestFixture::ExperimentValue& x) override
{
this->particles = std::vector<Particle>(x.Value);

Expand All @@ -39,7 +40,7 @@ class ParticlesObjVectorFixture : public ParticlesFixture
}

/// After each run, clear the vector
virtual void tearDown() override
void tearDown() override
{
this->particles.clear();
}
Expand Down Expand Up @@ -72,7 +73,7 @@ class ParticlesPtrVectorFixture : public ParticlesFixture
}

/// Before each run, build a vector of random integers.
virtual void setUp(const celero::TestFixture::ExperimentValue& experimentValue) override
void setUp(const celero::TestFixture::ExperimentValue& experimentValue) override
{
this->particles = std::vector<std::shared_ptr<Particle>>(experimentValue.Value);

Expand Down Expand Up @@ -102,7 +103,7 @@ class ParticlesPtrVectorFixture : public ParticlesFixture
}

/// After each run, clear the vector
virtual void tearDown() override
void tearDown() override
{
this->particles.clear();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <celero/Celero.h>

#include <algorithm>

#ifndef _WIN32
Expand Down Expand Up @@ -40,7 +41,7 @@ class SortFixture : public celero::TestFixture
{
}

virtual std::vector<celero::TestFixture::ExperimentValue> getExperimentValues() const override
std::vector<celero::TestFixture::ExperimentValue> getExperimentValues() const override
{
std::vector<celero::TestFixture::ExperimentValue> problemSpace;

Expand All @@ -55,14 +56,14 @@ class SortFixture : public celero::TestFixture
}

/// Before each sample, build a vector of random integers.
virtual void setUp(const celero::TestFixture::ExperimentValue& experimentValue) override
void setUp(const celero::TestFixture::ExperimentValue& experimentValue) override
{
this->arraySize = experimentValue.Value;
this->array.resize(this->arraySize);
}

// Before each iteration
virtual void onExperimentStart(const celero::TestFixture::ExperimentValue&) override
void onExperimentStart(const celero::TestFixture::ExperimentValue&) override
{
for(int i = 0; i < this->arraySize; i++)
{
Expand All @@ -71,14 +72,14 @@ class SortFixture : public celero::TestFixture
}

// After each iteration
virtual void onExperimentEnd() override
void onExperimentEnd() override
{
/// After each iteration, clear the vector of random integers.
this->array.clear();
}

// After each sample
virtual void tearDown() override
void tearDown() override
{
}

Expand Down
Loading

0 comments on commit ee16f37

Please sign in to comment.