Remove BM_opcodeSpec

This commit is contained in:
Jean Pierre Cimalando 2021-02-21 23:29:41 +01:00
parent 08558ceae2
commit e2a5c07edb
4 changed files with 0 additions and 90 deletions

View file

@ -1,72 +0,0 @@
// SPDX-License-Identifier: BSD-2-Clause
// This code is part of the sfizz library and is licensed under a BSD 2-clause
// license. You should have receive a LICENSE.md file along with the code.
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
#include "BM_opcodeSpec.h"
#include <benchmark/benchmark.h>
#include <random>
#include <numeric>
#include <vector>
#include <cmath>
#include <iostream>
class OpcodeSpecFixture : public benchmark::Fixture {
public:
void SetUp(const ::benchmark::State& state) {
std::random_device rd { };
std::mt19937 gen { rd() };
std::uniform_real_distribution<float> dist { 0.0f, 1.0f };
value = dist(gen);
}
void TearDown(const ::benchmark::State& /* state */) {
}
float value;
float returned;
};
BENCHMARK_DEFINE_F(OpcodeSpecFixture, ConstexprClamp)(benchmark::State& state) {
for (auto _ : state)
{
if (constexprSpec.flags | (1 << 2))
returned = constexprSpec.bounds.clamp(value);
benchmark::DoNotOptimize(returned);
}
}
BENCHMARK_DEFINE_F(OpcodeSpecFixture, ConstexprDontClamp)(benchmark::State& state) {
for (auto _ : state)
{
if (constexprSpec.flags | (1 << 1))
returned = constexprSpec.bounds.clamp(value);
benchmark::DoNotOptimize(returned);
}
}
BENCHMARK_DEFINE_F(OpcodeSpecFixture, ConstClamp)(benchmark::State& state) {
for (auto _ : state)
{
if (constSpec.flags | (1 << 2))
returned = constSpec.bounds.clamp(value);
benchmark::DoNotOptimize(returned);
}
}
BENCHMARK_DEFINE_F(OpcodeSpecFixture, ConstDontClamp)(benchmark::State& state) {
for (auto _ : state)
{
if (constSpec.flags | (1 << 1))
returned = constSpec.bounds.clamp(value);
benchmark::DoNotOptimize(returned);
}
}
BENCHMARK_REGISTER_F(OpcodeSpecFixture, ConstexprClamp);
BENCHMARK_REGISTER_F(OpcodeSpecFixture, ConstexprDontClamp);
BENCHMARK_REGISTER_F(OpcodeSpecFixture, ConstClamp);
BENCHMARK_REGISTER_F(OpcodeSpecFixture, ConstDontClamp);
BENCHMARK_MAIN();

View file

@ -1,14 +0,0 @@
#pragma once
#include "Range.h"
template<class T>
struct OpcodeSpec
{
T defaultValue;
sfz::Range<T> bounds;
int flags { 0 };
};
constexpr OpcodeSpec<float> constexprSpec { 0.0f, sfz::Range<float>(0.0f, 0.5f), 1 << 2 };
extern const OpcodeSpec<float> constSpec;

View file

@ -1,3 +0,0 @@
#include "BM_opcodeSpec.h"
const OpcodeSpec<float> constSpec { 0.0f, sfz::Range<float>(0.0f, 0.5f), 1 << 2 };

View file

@ -38,7 +38,6 @@ sfizz_add_benchmark(bm_mapVsArray BM_mapVsArray.cpp)
sfizz_add_benchmark(bm_random BM_random.cpp) sfizz_add_benchmark(bm_random BM_random.cpp)
sfizz_add_benchmark(bm_clamp BM_clamp.cpp) sfizz_add_benchmark(bm_clamp BM_clamp.cpp)
sfizz_add_benchmark(bm_allWithin BM_allWithin.cpp) sfizz_add_benchmark(bm_allWithin BM_allWithin.cpp)
sfizz_add_benchmark(bm_opcodeSpec BM_opcodeSpec.cpp BM_opcodeSpec_def.cpp)
sfizz_add_benchmark(bm_logger BM_logger.cpp) sfizz_add_benchmark(bm_logger BM_logger.cpp)
sfizz_add_benchmark(bm_smoothers BM_smoothers.cpp) sfizz_add_benchmark(bm_smoothers BM_smoothers.cpp)