Skip to content

Commit 9bf9fba

Browse files
committed
Add checkperf to cmake
1 parent 121615d commit 9bf9fba

File tree

8 files changed

+71
-54
lines changed

8 files changed

+71
-54
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ commands:
6767
steps:
6868
- cmake_build
6969
- run: ctest $CTEST_FLAGS -L acceptance
70-
- run: ctest $CTEST_FLAGS -LE acceptance
70+
- run: ctest $CTEST_FLAGS -LE acceptance -E checkperf
7171

7272
cmake_test_all:
7373
steps:

.drone.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ steps:
231231
- mkdir build && cd build
232232
- cmake $CMAKE_FLAGS ..
233233
- make -j
234-
- ctest -j --output-on-failure
234+
- ctest -j --output-on-failure -E checkperf
235235
---
236236
kind: pipeline
237237
name: amd64_clang_cmake_no_exceptions
@@ -254,7 +254,7 @@ steps:
254254
- mkdir build && cd build
255255
- cmake $CMAKE_FLAGS ..
256256
- make -j
257-
- ctest -j --output-on-failure
257+
- ctest -j --output-on-failure -E checkperf
258258
---
259259
kind: pipeline
260260
name: amd64_clang_cmake_static
@@ -277,7 +277,7 @@ steps:
277277
- mkdir build && cd build
278278
- cmake $CMAKE_FLAGS ..
279279
- make -j
280-
- ctest -j --output-on-failure
280+
- ctest -j --output-on-failure -E checkperf
281281
---
282282
kind: pipeline
283283
name: amd64_gcc_cmake_static
@@ -300,7 +300,7 @@ steps:
300300
- mkdir build && cd build
301301
- cmake $CMAKE_FLAGS ..
302302
- make -j
303-
- ctest -j --output-on-failure
303+
- ctest -j --output-on-failure -E checkperf
304304
---
305305
kind: pipeline
306306
name: amd64_gcc_cmake_dynamic
@@ -323,7 +323,7 @@ steps:
323323
- mkdir build && cd build
324324
- cmake $CMAKE_FLAGS ..
325325
- make -j
326-
- ctest -j --output-on-failure
326+
- ctest -j --output-on-failure -E checkperf
327327
---
328328
kind: pipeline
329329
name: arm64_clang_cmake_dynamic
@@ -346,7 +346,7 @@ steps:
346346
- mkdir build && cd build
347347
- cmake $CMAKE_FLAGS ..
348348
- make -j
349-
- ctest -j --output-on-failure
349+
- ctest -j --output-on-failure -E checkperf
350350
---
351351
kind: pipeline
352352
name: arm64_gcc_cmake_dynamic
@@ -369,7 +369,7 @@ steps:
369369
- mkdir build && cd build
370370
- cmake $CMAKE_FLAGS ..
371371
- make -j
372-
- ctest -j --output-on-failure
372+
- ctest -j --output-on-failure -E checkperf
373373
---
374374
kind: pipeline
375375
name: arm64_clang_cmake_static
@@ -392,7 +392,7 @@ steps:
392392
- mkdir build && cd build
393393
- cmake $CMAKE_FLAGS ..
394394
- make -j
395-
- ctest -j --output-on-failure
395+
- ctest -j --output-on-failure -E checkperf
396396
---
397397
kind: pipeline
398398
name: arm64_gcc_cmake_static
@@ -415,7 +415,7 @@ steps:
415415
- mkdir build && cd build
416416
- cmake $CMAKE_FLAGS ..
417417
- make -j
418-
- ctest -j --output-on-failure
418+
- ctest -j --output-on-failure -E checkperf
419419

420420
---
421421
kind: pipeline
@@ -439,7 +439,7 @@ steps:
439439
- mkdir build && cd build
440440
- cmake $CMAKE_FLAGS ..
441441
- make -j
442-
- ASAN_OPTIONS="detect_leaks=0" ctest -j --output-on-failure
442+
- ASAN_OPTIONS="detect_leaks=0" ctest -j --output-on-failure -E checkperf
443443
---
444444
kind: pipeline
445445
name: arm64_gcc_cmake_sanitize
@@ -462,7 +462,7 @@ steps:
462462
- mkdir build && cd build
463463
- cmake $CMAKE_FLAGS ..
464464
- make -j
465-
- ASAN_OPTIONS="detect_leaks=0" ctest -j --output-on-failure
465+
- ASAN_OPTIONS="detect_leaks=0" ctest -j --output-on-failure -E checkperf
466466

467467
---
468468
kind: pipeline
@@ -486,7 +486,7 @@ steps:
486486
- mkdir build && cd build
487487
- cmake $CMAKE_FLAGS ..
488488
- make -j
489-
- ASAN_OPTIONS="detect_leaks=0" ctest -j --output-on-failure
489+
- ASAN_OPTIONS="detect_leaks=0" ctest -j --output-on-failure -E checkperf
490490
---
491491
kind: pipeline
492492
name: amd64_gcc_cmake_sanitize
@@ -509,7 +509,7 @@ steps:
509509
- mkdir build && cd build
510510
- cmake $CMAKE_FLAGS ..
511511
- make -j
512-
- ASAN_OPTIONS="detect_leaks=0" ctest -j --output-on-failure
512+
- ASAN_OPTIONS="detect_leaks=0" ctest -j --output-on-failure -E checkperf
513513

514514
---
515515
kind: pipeline
@@ -533,7 +533,7 @@ steps:
533533
- mkdir build && cd build
534534
- cmake $CMAKE_FLAGS ..
535535
- make -j
536-
- ASAN_OPTIONS="detect_leaks=0" ctest -j --output-on-failure
536+
- ASAN_OPTIONS="detect_leaks=0" ctest -j --output-on-failure -E checkperf
537537
---
538538
kind: pipeline
539539
name: amd64_gcc_cmake_sanitize_noavx
@@ -556,4 +556,4 @@ steps:
556556
- mkdir build && cd build
557557
- cmake $CMAKE_FLAGS ..
558558
- make -j
559-
- ASAN_OPTIONS="detect_leaks=0" ctest -j --output-on-failure
559+
- ASAN_OPTIONS="detect_leaks=0" ctest -j --output-on-failure -E checkperf

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ objs
7171
/benchmark/parse_stream
7272
/benchmark/parsingcompetition
7373
/benchmark/perfdiff
74+
/benchmark/simdjson-master
7475
/benchmark/statisticalmodel
7576
/build/
7677
/build-ossfuzz-*/
@@ -131,6 +132,7 @@ objs
131132
/tests/allparserscheckfile
132133
/tests/basictests
133134
/tests/checkimplementation
135+
/tests/compilation_failure_tests/example_compiletest_should_compile
134136
/tests/errortests
135137
/tests/extracting_values_example
136138
/tests/integer_tests

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
REFERENCE_VERSION = master
1+
CHECKPERF_BRANCH = master
22

33
.SUFFIXES:
44
#
@@ -207,8 +207,8 @@ benchfeatures: benchmark/benchfeatures.cpp benchmark/event_counter.h benchmark/b
207207
perfdiff: benchmark/perfdiff.cpp
208208
$(CXX) $(CXXFLAGS) -o perfdiff benchmark/perfdiff.cpp $(LIBFILES) $(LIBFLAGS)
209209

210-
checkperf:
211-
bash ./scripts/checkperf.sh $(REFERENCE_VERSION)
210+
checkperf: parse perfdiff
211+
CHECKPERF_BRANCH=$(CHECKPERF_BRANCH) bash ./benchmark/checkperf.sh jsonexamples/twitter.json
212212

213213
statisticalmodel: benchmark/statisticalmodel.cpp $(HEADERS) $(LIBFILES)
214214
$(CXX) $(CXXFLAGS) -o statisticalmodel benchmark/statisticalmodel.cpp $(LIBFILES) $(LIBFLAGS)

benchmark/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,13 @@ if (SIMDJSON_COMPETITION)
3434
target_link_libraries(allparsingcompetition competition-all)
3535
target_compile_definitions(allparsingcompetition PRIVATE ALLPARSER)
3636
endif()
37+
38+
if (NOT MSVC)
39+
add_test(NAME checkperf
40+
COMMAND ${CMAKE_COMMAND} -E env
41+
CHECKPERF_REPOSITORY=https://github.com/simdjson/simdjson
42+
CHECKPERF_BRANCH=master
43+
CHECKPERF_DIR=${CMAKE_CURRENT_BINARY_DIR}/simdjson-master
44+
bash ${CMAKE_CURRENT_SOURCE_DIR}/checkperf.sh ${PROJECT_SOURCE_DIR}/jsonexamples/twitter.json)
45+
set_property(TEST checkperf APPEND PROPERTY DEPENDS parse perfdiff)
46+
endif()

benchmark/checkperf.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
set -ex
4+
5+
if [ -z "$CHECKPERF_REPOSITORY" ]; then CHECKPERF_REPOSITORY=.; fi
6+
7+
# Arguments: perfdiff.sh <branch> <test json files>
8+
if [ -z "$CHECKPERF_BRANCH" ]; then CHECKPERF_BRANCH=master; fi
9+
if [ -z "$CHECKPERF_DIR" ]; then CHECKPERF_DIR=benchbranch/$CHECKPERF_BRANCH; fi
10+
if [ -z "$CHECKPERF_ARGS" ]; then
11+
if [ -z "$*" ]; then
12+
CHECKPERF_ARGS=jsonexamples/twitter.json;
13+
else
14+
CHECKPERF_ARGS=$*;
15+
fi
16+
fi
17+
18+
# Clone and build the reference branch's parse
19+
if [ -d $CHECKPERF_DIR/.git ]; then
20+
echo "Checking out the reference branch ($CHECKPERF_BRANCH) into $CHECKPERF_DIR ..."
21+
pushd $CHECKPERF_DIR
22+
git remote update
23+
git reset --hard origin/$CHECKPERF_BRANCH
24+
else
25+
echo "Cloning the reference branch ($CHECKPERF_BRANCH) into $CHECKPERF_DIR ..."
26+
mkdir -p $CHECKPERF_DIR
27+
git clone --depth 1 -b $CHECKPERF_BRANCH $CHECKPERF_REPOSITORY $CHECKPERF_DIR
28+
pushd $CHECKPERF_DIR
29+
fi
30+
31+
echo "Building $CHECKPERF_DIR/parse ..."
32+
make parse
33+
popd
34+
35+
# Run them and diff performance
36+
echo "Running perfdiff:"
37+
echo ./perfdiff \"./parse -t $CHECKPERF_ARGS\" \"$CHECKPERF_DIR/parse -t $CHECKPERF_ARGS\"
38+
./perfdiff "./parse -t $CHECKPERF_ARGS" "$CHECKPERF_DIR/parse -t $CHECKPERF_ARGS"

scripts/checkperf.sh

Lines changed: 0 additions & 33 deletions
This file was deleted.

src/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ target_link_libraries(simdjson PRIVATE simdjson-source simdjson-flags)
4949
if(NOT MSVC)
5050
## We output the library at the root of the current directory where cmake is invoked
5151
## This is handy but Visual Studio will happily ignore us
52-
set_target_properties(simdjson PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
53-
MESSAGE( STATUS "Library output directory (does not apply to Visual Studio): " ${CMAKE_BINARY_DIR})
52+
set_target_properties(simdjson PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
53+
MESSAGE( STATUS "Library output directory (does not apply to Visual Studio): " ${PROJECT_BINARY_DIR})
5454
endif()
5555

5656
#

0 commit comments

Comments
 (0)