Skip to content

Commit a825cfd

Browse files
authored
Merge pull request #5 from linksplatform/add_cpp_benchmark
Add C++ benchmark
2 parents 82a5e64 + 80e4736 commit a825cfd

File tree

20 files changed

+1736
-214
lines changed

20 files changed

+1736
-214
lines changed

.github/workflows/cpp.yml

Lines changed: 80 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,94 @@
1-
name: cpp
1+
name: Benchmark C++ version
22

33
on:
44
push:
5-
branches: main
6-
paths:
7-
- 'cpp/**'
8-
- '.github/workflows/cpp.yml'
9-
10-
env:
11-
NUGETTOKEN: ${{ secrets.NUGET_TOKEN }}
12-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13-
SCRIPTS_BASE_URL: https://raw.githubusercontent.com/linksplatform/Scripts/main/MultiProjectRepository
14-
15-
defaults:
16-
run:
17-
working-directory: cpp
5+
branches:
6+
- add_cpp_benchmark
187

198
jobs:
20-
test:
9+
benchmark:
2110
runs-on: ubuntu-latest
11+
12+
services:
13+
postgres:
14+
image: postgres:latest
15+
env:
16+
POSTGRES_USER: postgres
17+
POSTGRES_PASSWORD: postgres
18+
POSTGRES_DB: postgres
19+
options: >-
20+
--health-cmd pg_isready
21+
--health-interval 10s
22+
--health-timeout 5s
23+
--health-retries 5
24+
ports:
25+
- 5432:5432
26+
2227
steps:
23-
- uses: actions/checkout@v1
28+
- name: Checkout repository and submodules
29+
uses: actions/checkout@v2
2430
with:
25-
submodules: true
26-
- name: Setup clang
27-
uses: egor-tensin/setup-clang@v1
31+
submodules: recursive
32+
- name: Set up CMake and Conan
33+
uses: actions/setup-python@v2
2834
with:
29-
version: 13
30-
platform: x64
31-
- name: Install conan
32-
run: pip install conan
33-
- name: Setup conan
35+
python-version: '3.x'
36+
- name: Install utilities
3437
run: |
35-
conan profile new linksplatform --detect
36-
conan profile update settings.compiler=clang linksplatform
37-
conan profile update settings.compiler.version=13 linksplatform
38-
conan profile update settings.compiler.libcxx=libstdc++11 linksplatform
39-
conan profile update env.CXX=clang++ linksplatform
40-
conan profile show linksplatform
41-
- name: Instll conan packages
38+
sudo apt update
39+
sudo apt install -y cmake build-essential
40+
pip install conan
41+
- name: Set up Conan dependencies
4242
run: |
43-
if [ -f "install-local-conan-dependencies.sh" ]; then
44-
echo "install-local-conan-dependencies.sh exists."
45-
./install-local-conan-dependencies.sh
46-
fi
47-
- name: Test and scan-build
43+
conan profile detect
44+
echo "
45+
[settings]
46+
arch=x86_64
47+
build_type=Release
48+
compiler=gcc
49+
compiler.cppstd=gnu20
50+
compiler.libcxx=libstdc++11
51+
compiler.version=11
52+
os=Linux
53+
" > ~/.conan2/profiles/default
54+
conan profile show
55+
- name: Install dependencies
4856
run: |
49-
CXX=clang++
50-
cmake_flags="-DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang++ -DLINKS_PLATFORM_TESTS=TRUE"
51-
cmake_build_dir="build"
52-
mkdir $cmake_build_dir && cd $cmake_build_dir
53-
conan install .. -pr=linksplatform --build=missing
54-
cmake .. "$cmake_flags"
55-
cmake --build .
56-
ls
57-
pushToNuget:
58-
runs-on: ubuntu-latest
59-
needs: test
60-
steps:
61-
- uses: actions/checkout@v1
62-
with:
63-
submodules: true
64-
- name: Read package information
65-
run: |
66-
export REPOSITORY_NAME=$(basename ${{ github.repository }})
67-
wget "$SCRIPTS_BASE_URL/read_cpp_package_info.sh"
68-
bash ./read_cpp_package_info.sh
69-
- name: Publish NuGet package
70-
run: |
71-
export REPOSITORY_NAME=$(basename ${{ github.repository }})
72-
wget "$SCRIPTS_BASE_URL/push-cpp-nuget.sh"
73-
bash ./push-cpp-nuget.sh
74-
publiseRelease:
75-
runs-on: ubuntu-latest
76-
needs: test
77-
steps:
78-
- uses: actions/checkout@v1
79-
with:
80-
submodules: true
81-
- name: Read project information
57+
git clone https://github.com/linksplatform/conan-center-index
58+
cd conan-center-index && cd recipes
59+
conan create platform.interfaces/all --version 0.3.41
60+
conan create platform.delegates/all --version 0.3.7
61+
conan create platform.exceptions/all --version 0.3.2
62+
conan create platform.converters/all --version 0.2.0
63+
conan create platform.hashing/all --version 0.5.6 --build=missing
64+
conan create platform.ranges/all --version 0.2.0
65+
conan create platform.random/all --version 0.2.0
66+
conan create platform.equality/all --version 0.0.1
67+
conan create platform.collections/all --version 0.2.1
68+
conan create platform.setters/all --version 0.1.0
69+
conan create platform.data/all --version 0.1.1
70+
conan create platform.numbers/all --version 0.1.0
71+
conan create platform.memory/all --version 0.1.0 --build=missing
72+
conan create platform.collections.methods/all --version 0.3.0
73+
conan create platform.data.doublets/all --version 0.1.0
74+
- name: Build benchmark
8275
run: |
83-
export REPOSITORY_NAME=$(basename ${{ github.repository }})
84-
wget "$SCRIPTS_BASE_URL/read_cpp_package_info.sh"
85-
bash ./read_cpp_package_info.sh
86-
- name: Publish release
76+
cd cpp
77+
conan install . -of=build --build=missing
78+
cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=/home/runner/work/Comparisons.PostgreSQLVSDoublets/Comparisons.PostgreSQLVSDoublets/cpp/build/conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release -S . -B build
79+
cd build
80+
make
81+
- name: Run benchmark
82+
run: ./cpp/build/bin/PSQLBench --benchmark_out=cpp/out.txt --benchmark_out_format=console
83+
- name: Prepare benchmark results
8784
run: |
88-
export REPOSITORY_NAME=$(basename ${{ github.repository }})
89-
wget "$SCRIPTS_BASE_URL/publish-release.sh"
90-
chmod +x ./publish-release.sh
91-
wget "$SCRIPTS_BASE_URL/publish-cpp-release.sh"
92-
bash ./publish-cpp-release.sh
85+
cd cpp
86+
pip install numpy matplotlib
87+
python3 out.py
88+
- name: Save benchmark results
89+
uses: actions/upload-artifact@v3
90+
with:
91+
name: Benchmark results
92+
path: |
93+
cpp/Bench1.png
94+
cpp/Bench2.png

.github/workflows/csharp.yml

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

.gitmodules

Whitespace-only changes.

cpp/Benchmarks/AllBenchmarks.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include <Platform.Data.Doublets.h>
2+
#include <Platform.Data.h>
3+
#include <pqxx/pqxx>
4+
#include <benchmark/benchmark.h>
5+
#include <ISQL.h>
6+
#include <PSQLBase.h>
7+
#include <Client.h>
8+
#include <Transaction.h>
9+
10+
const std::string options {"user=postgres dbname=postgres password=postgres host=localhost port=5432"};
11+
constexpr std::uint64_t BACKGROUND_LINKS {3000};
12+
13+
#include "SetupTeardown.cpp"
14+
#include "Create.cpp"
15+
#include "Delete.cpp"
16+
#include "Each/Identity.cpp"
17+
#include "Each/Concrete.cpp"
18+
#include "Each/Outgoing.cpp"
19+
#include "Each/Incoming.cpp"
20+
#include "Each/All.cpp"
21+
#include "Update.cpp"
22+
23+
BENCHMARK_MAIN();

0 commit comments

Comments
 (0)