From af0369d812c33c8d9c1433099df865f8c5bf74ad Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Wed, 15 Jul 2015 12:59:42 -0700 Subject: [PATCH] add no-op rendering benchmark - refs #2976 --- benchmark/build.py | 1 + benchmark/test_noop_rendering.cpp | 53 +++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 benchmark/test_noop_rendering.cpp diff --git a/benchmark/build.py b/benchmark/build.py index 8b2049e24..800a9abb5 100644 --- a/benchmark/build.py +++ b/benchmark/build.py @@ -46,6 +46,7 @@ benchmarks = [ "test_offset_converter.cpp", "test_marker_cache.cpp", "test_quad_tree.cpp", + "test_noop_rendering.cpp", # "test_numeric_cast_vs_static_cast.cpp", ] for cpp_test in benchmarks: diff --git a/benchmark/test_noop_rendering.cpp b/benchmark/test_noop_rendering.cpp new file mode 100644 index 000000000..03d2e675c --- /dev/null +++ b/benchmark/test_noop_rendering.cpp @@ -0,0 +1,53 @@ +#include "bench_framework.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +class test : public benchmark::test_case +{ +public: + test(mapnik::parameters const& params) + : test_case(params) {} + + bool validate() const + { + return true; + } + bool operator()() const + { + mapnik::Map m(256,256,"+init=epsg:3857"); + + mapnik::parameters params; + params["type"]="memory"; + auto ds = std::make_shared(params); + // add whitespace to trigger phony "reprojection" + mapnik::layer lay("layer",m.srs() + " "); + lay.set_datasource(ds); + lay.add_style("style"); + m.add_layer(lay); + // dummy style to ensure that layer is processed + m.insert_style("style",mapnik::feature_type_style()); + // dummy bbox, but "valid" because minx and miny are less + // with an invalid bbox then layer.visible() returns false + // and the initial rendering setup is not run + m.zoom_to_box(mapnik::box2d(-1,-1,0,0)); + for (unsigned i=0;i ren(m,im); + ren.apply(); + } + return true; + } +}; + +BENCHMARK(test,"rendering with reprojection")