Use gperf - not faster yet
This commit is contained in:
@@ -73,10 +73,22 @@ include_directories(src)
|
||||
|
||||
find_package(weaseljson REQUIRED)
|
||||
|
||||
# Generate JSON token hash table using gperf
|
||||
find_program(GPERF_EXECUTABLE gperf REQUIRED)
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_BINARY_DIR}/json_tokens.cpp
|
||||
COMMAND ${GPERF_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/json_tokens.gperf >
|
||||
${CMAKE_BINARY_DIR}/json_tokens.cpp
|
||||
DEPENDS ${CMAKE_SOURCE_DIR}/src/json_tokens.gperf
|
||||
COMMENT "Generating JSON token hash table with gperf")
|
||||
add_custom_target(generate_json_tokens
|
||||
DEPENDS ${CMAKE_BINARY_DIR}/json_tokens.cpp)
|
||||
|
||||
set(SOURCES src/main.cpp src/config.cpp src/commit_request.cpp
|
||||
src/arena_allocator.cpp)
|
||||
src/arena_allocator.cpp ${CMAKE_BINARY_DIR}/json_tokens.cpp)
|
||||
|
||||
add_executable(weaseldb ${SOURCES})
|
||||
add_dependencies(weaseldb generate_json_tokens)
|
||||
target_link_libraries(weaseldb Threads::Threads toml11::toml11 weaseljson
|
||||
simdutf::simdutf)
|
||||
|
||||
@@ -92,8 +104,10 @@ target_link_libraries(test_arena_allocator doctest::doctest)
|
||||
target_include_directories(test_arena_allocator PRIVATE src)
|
||||
|
||||
add_executable(
|
||||
test_commit_request tests/test_commit_request.cpp src/commit_request.cpp
|
||||
src/arena_allocator.cpp)
|
||||
test_commit_request
|
||||
tests/test_commit_request.cpp src/commit_request.cpp src/arena_allocator.cpp
|
||||
${CMAKE_BINARY_DIR}/json_tokens.cpp)
|
||||
add_dependencies(test_commit_request generate_json_tokens)
|
||||
target_link_libraries(test_commit_request doctest::doctest weaseljson test_data
|
||||
simdutf::simdutf)
|
||||
target_include_directories(test_commit_request PRIVATE src)
|
||||
@@ -104,23 +118,29 @@ target_link_libraries(bench_arena_allocator nanobench)
|
||||
target_include_directories(bench_arena_allocator PRIVATE src)
|
||||
|
||||
add_executable(
|
||||
bench_commit_request benchmarks/bench_commit_request.cpp
|
||||
src/commit_request.cpp src/arena_allocator.cpp)
|
||||
bench_commit_request
|
||||
benchmarks/bench_commit_request.cpp src/commit_request.cpp
|
||||
src/arena_allocator.cpp ${CMAKE_BINARY_DIR}/json_tokens.cpp)
|
||||
add_dependencies(bench_commit_request generate_json_tokens)
|
||||
target_link_libraries(bench_commit_request nanobench weaseljson test_data
|
||||
simdutf::simdutf)
|
||||
target_include_directories(bench_commit_request PRIVATE src)
|
||||
|
||||
add_executable(
|
||||
bench_parser_comparison benchmarks/bench_parser_comparison.cpp
|
||||
src/commit_request.cpp src/arena_allocator.cpp)
|
||||
bench_parser_comparison
|
||||
benchmarks/bench_parser_comparison.cpp src/commit_request.cpp
|
||||
src/arena_allocator.cpp ${CMAKE_BINARY_DIR}/json_tokens.cpp)
|
||||
add_dependencies(bench_parser_comparison generate_json_tokens)
|
||||
target_link_libraries(bench_parser_comparison nanobench weaseljson test_data
|
||||
nlohmann_json::nlohmann_json simdutf::simdutf)
|
||||
target_include_directories(bench_parser_comparison
|
||||
PRIVATE src ${rapidjson_SOURCE_DIR}/include)
|
||||
|
||||
# Debug tools
|
||||
add_executable(debug_arena tools/debug_arena.cpp src/commit_request.cpp
|
||||
src/arena_allocator.cpp)
|
||||
add_executable(
|
||||
debug_arena tools/debug_arena.cpp src/commit_request.cpp
|
||||
src/arena_allocator.cpp ${CMAKE_BINARY_DIR}/json_tokens.cpp)
|
||||
add_dependencies(debug_arena generate_json_tokens)
|
||||
target_link_libraries(debug_arena weaseljson simdutf::simdutf)
|
||||
target_include_directories(debug_arena PRIVATE src)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user