Skip to content

Commit

Permalink
Disable benchmarks in debug builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadden committed Sep 16, 2020
1 parent 4e0e261 commit 2edfb67
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions unit_tests/flow/for_each.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,11 +558,13 @@ TEST_CASE("item list", "[for_each][list]")
check_traversal(sys, controller, "apple;banana;cherry;");
REQUIRE(call_count == 3);

#ifdef NDEBUG
// Also do some benchmarking while we're here.
BENCHMARK("stable list for_each")
{
refresh_system(sys);
};
#endif

std::reverse(container.begin(), container.end());

Expand Down
2 changes: 2 additions & 0 deletions unit_tests/signals/operators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,12 @@ TEST_CASE("vector subscript", "[signals][operators]")
auto c_signal = direct(c);
auto s = c_signal[value(1)];

#ifdef NDEBUG
BENCHMARK("subscript signal creation")
{
return c_signal[value(1)];
};
#endif

typedef decltype(s) signal_t;
REQUIRE((std::is_same<signal_t::value_type, int>::value));
Expand Down
4 changes: 4 additions & 0 deletions unit_tests/signals/state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,18 @@ TEST_CASE("state changes and component dirtying", "[signals][state]")
REQUIRE(log.str() == "clean;12;clean;12;writing;dirty;13;clean;13;");

// And some benchmarking...
#ifdef NDEBUG
BENCHMARK("deep state changes")
{
refresh_system(sys);

my_state_change_event e;
dispatch_event(sys, e);
};
#endif
}

#ifdef NDEBUG
TEST_CASE("get_state benchmarks", "[signals][state]")
{
BENCHMARK("get_state")
Expand All @@ -175,3 +178,4 @@ TEST_CASE("get_state benchmarks", "[signals][state]")
refresh_system(sys);
};
}
#endif

0 comments on commit 2edfb67

Please sign in to comment.