Skip to content

Commit 03c7c3b

Browse files
committed
Add benchmarks
1 parent b3529a0 commit 03c7c3b

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

.github/workflows/main.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
- uses: actions/checkout@v3
4848
- name: Install dependencies
4949
run: |
50-
sudo apt install ninja-build
50+
sudo apt install ninja-build libbenchmark-dev
5151
if [ "${{ matrix.cxxlib }}" = "libc++" ]; then
5252
sudo apt remove -y 'libc++*'
5353
apt search libunwind
@@ -71,7 +71,7 @@ jobs:
7171
export EMBEDDED_BLOCKS_RUNTIME=ON
7272
fi
7373
ls -lahR /usr/lib/llvm-${{ matrix.llvm-version }}/lib/
74-
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build-type}} -G Ninja -DTESTS=ON -DEMBEDDED_BLOCKS_RUNTIME=$EMBEDDED_BLOCKS_RUNTIME -DCMAKE_C_COMPILER=clang-${{matrix.llvm-version}} -DCMAKE_OBJC_COMPILER=clang-${{matrix.llvm-version}} -DCMAKE_ASM_COMPILER=clang-${{matrix.llvm-version}} -DCMAKE_CXX_COMPILER=clang++-${{matrix.llvm-version}} -DCMAKE_OBJCXX_COMPILER=clang++-${{matrix.llvm-version}} -DCMAKE_CXX_FLAGS="-stdlib=${{matrix.cxxlib}}"
74+
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build-type}} -G Ninja -DTESTS=ON -DBENCHMARKS=ON -DEMBEDDED_BLOCKS_RUNTIME=$EMBEDDED_BLOCKS_RUNTIME -DCMAKE_C_COMPILER=clang-${{matrix.llvm-version}} -DCMAKE_OBJC_COMPILER=clang-${{matrix.llvm-version}} -DCMAKE_ASM_COMPILER=clang-${{matrix.llvm-version}} -DCMAKE_CXX_COMPILER=clang++-${{matrix.llvm-version}} -DCMAKE_OBJCXX_COMPILER=clang++-${{matrix.llvm-version}} -DCMAKE_CXX_FLAGS="-stdlib=${{matrix.cxxlib}}"
7575
# Build with a nice ninja status line
7676
- name: Build
7777
working-directory: ${{github.workspace}}/build
@@ -81,6 +81,10 @@ jobs:
8181
working-directory: ${{github.workspace}}/build
8282
run: |
8383
ctest --output-on-failure -j 4
84+
- name: Benchmark
85+
working-directory: ${{github.workspace}}/build
86+
run: |
87+
./benchmark/objc_msgSend
8488
8589
qemu-crossbuild:
8690
strategy:
@@ -237,12 +241,12 @@ jobs:
237241
with:
238242
msystem: ${{ matrix.msystem }}
239243
update: true
240-
install: git mingw-w64-${{ matrix.package-prefix }}-clang mingw-w64-${{ matrix.package-prefix }}-lld mingw-w64-${{ matrix.package-prefix }}-cmake
244+
install: git mingw-w64-${{ matrix.package-prefix }}-clang mingw-w64-${{ matrix.package-prefix }}-lld mingw-w64-${{ matrix.package-prefix }}-cmake mingw-w64-${{ matrix.package-prefix }}-benchmark
241245
- name: Configure CMake
242246
run: |
243247
mkdir build
244248
cd build
245-
${{ matrix.cmake-flags }} cmake .. -DTESTS=ON -DCMAKE_C_COMPILER="clang" -DCMAKE_CXX_COMPILER="clang++" -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DSTRICT_APPLE_COMPATIBILITY=${{ matrix.strict-apple-compatibility }}
249+
${{ matrix.cmake-flags }} cmake .. -DTESTS=ON -DBENCHMARKS=ON -DCMAKE_C_COMPILER="clang" -DCMAKE_CXX_COMPILER="clang++" -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DSTRICT_APPLE_COMPATIBILITY=${{ matrix.strict-apple-compatibility }}
246250
- name: Build
247251
working-directory: build
248252
run: |
@@ -251,6 +255,10 @@ jobs:
251255
working-directory: build
252256
run: |
253257
ctest -j 4 --output-on-failure -T test ${{ matrix.ctest-flags }}
258+
- name: Benchmark
259+
working-directory: build
260+
run: |
261+
./benchmarks/objc_msgSend.exe
254262
- name: Install
255263
working-directory: build
256264
run: |

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ option(DEBUG_ARC_COMPAT
140140
"Log warnings for classes that don't hit ARC fast paths" OFF)
141141
option(ENABLE_OBJCXX "Enable support for Objective-C++" ON)
142142
option(TESTS "Enable building the tests")
143+
option(BENCHMARKS "Enable building the benchmarks" OFF)
143144
option(EMBEDDED_BLOCKS_RUNTIME "Include an embedded blocks runtime, rather than relying on libBlocksRuntime to supply it" ON)
144145
option(STRICT_APPLE_COMPATIBILITY "Use strict Apple compatibility, always defining BOOL as signed char" OFF)
145146

@@ -448,6 +449,10 @@ if (TESTS)
448449
add_subdirectory(Test)
449450
endif (TESTS)
450451

452+
if (BENCHMARKS)
453+
add_subdirectory(benchmarks)
454+
endif()
455+
451456
CHECK_CXX_SOURCE_COMPILES("
452457
#include <stdlib.h>
453458
extern \"C\" {

0 commit comments

Comments
 (0)