-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from stevenewald/bench
Added benchmarks and ARM NEON support
- Loading branch information
Showing
35 changed files
with
733 additions
and
345 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
project(FractalBenchmarks LANGUAGES CXX) | ||
if(NOT CMAKE_BUILD_TYPE) | ||
set(CMAKE_BUILD_TYPE Debug) | ||
endif() | ||
# ---- Dependencies ---- | ||
|
||
find_package(benchmark REQUIRED) | ||
|
||
# ---- Benchmarks ---- | ||
add_executable(fractal_benchmarks | ||
source/bench.cpp | ||
source/main.cpp | ||
) | ||
|
||
target_include_directories( | ||
fractal_benchmarks ${warning_guard} | ||
PUBLIC | ||
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/source>" | ||
) | ||
|
||
target_link_libraries( | ||
fractal_benchmarks PRIVATE | ||
fractal-generator_lib | ||
sfml-graphics | ||
benchmark::benchmark | ||
) | ||
|
||
# Enable lto for release builds | ||
include(CheckIPOSupported) | ||
check_ipo_supported(RESULT lto_supported OUTPUT error) | ||
if(lto_supported) | ||
set_target_properties(fractal_benchmarks PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE) | ||
else() | ||
message(WARNING "LTO is not supported: ${error}") | ||
endif() | ||
|
||
target_compile_features(fractal_benchmarks PRIVATE cxx_std_23) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include "config.hpp" | ||
#include "units/coordinates.hpp" | ||
#include "graphics/display_to_complex.hpp" | ||
#include "mandelbrot/equations.hpp" | ||
#include "mandelbrot/equations.hpp" | ||
#include "units/units.hpp" | ||
|
||
#include <benchmark/benchmark.h> | ||
|
||
using namespace fractal; | ||
|
||
static void BM_GenerateMandelbrotSimd(benchmark::State& state) | ||
{ | ||
DisplayDomain display = { | ||
{0, 0 }, | ||
{800, 800} | ||
}; | ||
complex_domain complex = START_COMPLEX_DOMAIN; | ||
avx512_complex start{}; | ||
DisplayToComplexCoordinates t{display, complex}; | ||
|
||
std::int64_t prox = 0; | ||
for (auto _ : state) { | ||
for (auto it = display.begin(); it != display.end(); it += 8) { | ||
benchmark::DoNotOptimize( | ||
compute_iterations(start, t.to_complex_projections(*it), 100) | ||
); | ||
} | ||
prox += display.size(); | ||
} | ||
state.SetItemsProcessed(prox); | ||
} | ||
|
||
BENCHMARK(BM_GenerateMandelbrotSimd)->Arg(0); | ||
// BENCHMARK(BM_GenerateMandelbrotSimd)->Arg(100000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#include <benchmark/benchmark.h> | ||
BENCHMARK_MAIN(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
#pragma once | ||
|
||
#include "units.hpp" | ||
#include "units/units.hpp" | ||
#include "util.hpp" | ||
|
||
#include <cassert> | ||
|
||
namespace fractal { | ||
color hsv_to_rgb(float hue, float saturation, float value); | ||
|
||
color ratio_to_rgb(float ratio); | ||
color hsv_to_rgb(Hue hue, Percentage saturation, Percentage value); | ||
|
||
color ratio_to_rgb(Percentage ratio); | ||
} // namespace fractal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.