Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add benchmarks for json string serialize/deserialize #12258

Merged
merged 13 commits into from
May 6, 2022
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ set(RUN_IN_PLACE ${DEFAULT_RUN_IN_PLACE} CACHE BOOL
set(BUILD_CLIENT TRUE CACHE BOOL "Build client")
set(BUILD_SERVER FALSE CACHE BOOL "Build server")
set(BUILD_UNITTESTS TRUE CACHE BOOL "Build unittests")
set(BUILD_BENCHMARKS FALSE CACHE BOOL "Build benchmarks")

set(WARN_ALL TRUE CACHE BOOL "Enable -Wall for Release build")

Expand Down Expand Up @@ -280,6 +281,10 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?Clang")
endif()
endif()

if(BUILD_BENCHMARKS)
add_subdirectory(lib/catch2)
endif()

# Subdirectories
# Be sure to add all relevant definitions above this
add_subdirectory(src)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ General options and their default values:
BUILD_CLIENT=TRUE - Build Minetest client
BUILD_SERVER=FALSE - Build Minetest server
BUILD_UNITTESTS=TRUE - Build unittest sources
BUILD_BENCHMARKS=FALSE - Build benchmark sources
CMAKE_BUILD_TYPE=Release - Type of build (Release vs. Debug)
Release - Release build
Debug - Debug build
Expand Down
16 changes: 16 additions & 0 deletions lib/catch2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# catch2 is distributed as a standalone header.
#
# Downloaded from:
#
# https://github.com/catchorg/Catch2/releases/download/v2.13.9/catch.hpp
#
# The following changes were made to always print in microseconds, fixed format:
#
# - explicit Duration(double inNanoseconds, Unit units = Unit::Auto)
# + explicit Duration(double inNanoseconds, Unit units = Unit::Microseconds)
#
# - return os << duration.value() << ' ' << duration.unitsAsString();
# + return os << std::fixed << duration.value() << ' ' << duration.unitsAsString();

add_library(catch2 INTERFACE)
target_include_directories(catch2 INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
Loading