Skip to content

Commit

Permalink
Update of termbench with scripts to create plots
Browse files Browse the repository at this point in the history
  • Loading branch information
Yaraslaut committed Mar 16, 2024
1 parent 7f86c88 commit 49d5f1e
Show file tree
Hide file tree
Showing 15 changed files with 767 additions and 354 deletions.
81 changes: 81 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
BasedOnStyle: Microsoft
AccessModifierOffset: '-2'
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: 'true'
AlignConsecutiveDeclarations: 'false'
AlignEscapedNewlines: Left
AlignOperands: 'true'
AlignTrailingComments: 'true'
AllowAllArgumentsOnNextLine: 'true'
AllowAllConstructorInitializersOnNextLine: 'true'
AllowAllParametersOfDeclarationOnNextLine: 'true'
AllowShortBlocksOnASingleLine: 'false'
AllowShortCaseLabelsOnASingleLine: 'true'
AllowShortFunctionsOnASingleLine: InlineOnly
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: Inline
AllowShortLoopsOnASingleLine: 'false'
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: 'false'
AlwaysBreakTemplateDeclarations: 'Yes'
BinPackArguments: 'false'
BinPackParameters: 'false'
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: 'true'
BreakConstructorInitializers: AfterColon
BreakInheritanceList: AfterColon
BreakStringLiterals: 'true'
ColumnLimit: '110'
CompactNamespaces: 'false'
ConstructorInitializerAllOnOneLineOrOnePerLine: 'true'
ConstructorInitializerIndentWidth: '4'
ContinuationIndentWidth: '4'
Cpp11BracedListStyle: 'false'
DerivePointerAlignment: 'false'
FixNamespaceComments: 'true'
IncludeBlocks: Regroup
IndentCaseLabels: true
IndentPPDirectives: BeforeHash
IndentWidth: '4'
IndentWrappedFunctionNames: 'false'
Language: Cpp
MaxEmptyLinesToKeep: '1'
NamespaceIndentation: Inner
PenaltyBreakAssignment: '0'
PointerAlignment: Left
ReflowComments: 'true'
SortIncludes: 'true'
SortUsingDeclarations: 'true'
SpaceAfterCStyleCast: 'true'
SpaceAfterLogicalNot: 'false'
SpaceAfterTemplateKeyword: 'true'
SpaceBeforeAssignmentOperators: 'true'
SpaceBeforeCpp11BracedList: 'true'
SpaceBeforeCtorInitializerColon: 'false'
SpaceBeforeInheritanceColon: 'false'
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: 'false'
SpaceInEmptyParentheses: 'false'
SpacesInAngles: 'false'
SpacesInCStyleCastParentheses: 'false'
SpacesInContainerLiterals: 'false'
SpacesInParentheses: 'false'
SpacesInSquareBrackets: 'false'
Standard: Cpp11
TabWidth: '4'
UseTab: Never
IncludeCategories:
- Regex: '^<(tb)/'
Priority: 0
- Regex: '^<(libtermbench)/'
Priority: 1
- Regex: '^<sys/'
Priority: 80
- Regex: '^<[[:alnum:]_]+>'
Priority: 81
- Regex: '<[[:alnum:]_]+\.h>'
Priority: 82
- Regex: '.*'
Priority: 99
10 changes: 10 additions & 0 deletions .github/mock-font-locator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

mock_font_locator:
# Ubuntu 20.04
- { family: "monospace", slant: normal, weight: normal, path: "/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf" }
- { family: "emoji", slant: normal, weight: normal, path: "/usr/share/fonts/truetype/noto/NotoColorEmoji.ttf" }

# That would be it for macOS
# - { family: "monospace", slant: normal, weight: normal, path: "/Users/trapni/Library/Fonts/JetBrains Mono Regular Nerd Font Complete Mono.ttf" }
# - { family: "emoji", slant: normal, weight: normal, path: "/System/Library/Fonts/Apple Color Emoji.ttc" }

96 changes: 42 additions & 54 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,26 @@ env:
CTEST_OUTPUT_ON_FAILURE: 1

jobs:


check_clang_format:
name: "Check C++ style"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Install clang
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 17
sudo apt-get install clang-format-17
- name: "Clang-format libtermbench"
run: find ./libtermbench -name "*.cpp" -o -name "*.h" | xargs clang-format-17 --Werror --dry-run
- name: "Clang-format tb1"
run: find ./tb -name "*.cpp" -o -name "*.h" | xargs clang-format-17 --Werror --dry-run
- name: "Check includes"
run: ./scripts/check-includes.sh

ubuntu_linux:
name: "Ubuntu Linux 22.04"
runs-on: ubuntu-22.04
Expand All @@ -43,62 +63,30 @@ jobs:
set -ex
sudo apt -q update
sudo ./scripts/install-deps.sh
- name: "Install GCC 13"
run: sudo apt install g++-13
- name: "cmake"
run: cmake -S . -B build -DCMAKE_BUILD_TYPE="RelWithDebInfo"
run: cmake -S . -B build -DCMAKE_BUILD_TYPE="RelWithDebInfo" -D CMAKE_CXX_COMPILER="g++-13"
- name: "build"
run: cmake --build build/ -- -j3

osx:
name: "OS/X"
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: "**/cpm_modules"
key: ${{github.workflow}}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}
- name: set variables
id: set_vars
run: ./scripts/ci-set-vars.sh
env:
REPOSITORY: ${{ github.event.repository.name }}
- name: "Install dependencies"
- name: "install dependencies"
run: ./scripts/xvfb-deps.sh
- name: "Install contour"
run: |
set -ex
#brew update
./scripts/install-deps.sh
- name: "Create build directory"
run: mkdir build
- name: "Generate build files"
run: cmake -S . -B build -DCMAKE_BUILD_TYPE="RelWithDebInfo"
- name: "Build"
run: cmake --build build/

windows:
name: "Windows"
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: setup environment
shell: powershell
id: set_vars
run: .\scripts\ci-set-vars.ps1
env:
REPOSITORY: ${{ github.event.repository.name }}
- name: "vcpkg: Install dependencies"
uses: lukka/[email protected]
id: runvcpkg
with:
vcpkgDirectory: ${{ runner.workspace }}/vcpkg/
vcpkgGitCommitId: 3e93bb69a1cadeb36fe9eca3b6f3912d84f618d5
- name: "create build directory"
shell: powershell
wget https://github.com/contour-terminal/contour/releases/download/v0.4.3.6442/contour-0.4.3.6442-ubuntu22.04-amd64.deb
sudo dpkg -i contour-0.4.3.6442-ubuntu22.04-amd64.deb
- name: "create and patch contour.yml config file"
run: |
If (!(Test-Path build))
{
New-Item -ItemType Directory -Force -Path build
}
- name: "Generate build files"
run: cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="${{ runner.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows -B build .
- name: "Build"
run: cmake --build build/ --config Release
set -ex
mkdir -p ~/.config/contour/
contour generate config to ~/.config/contour/contour.yml
sed -i -e 's/locator: native/locator: mock/' ~/.config/contour/contour.yml
sed -i -e 's/strict_spacing: true/strict_spacing: false/' ~/.config/contour/contour.yml
cat .github/mock-font-locator.yml >> ~/.config/contour/contour.yml
cat ~/.config/contour/contour.yml
- name: "Install other terminals and dependencies"
run: sudo apt install -y kitty xterm xvfb
- name: "run benchmarks"
run: ./scripts/Xvfb-bench-run.sh
- name: "ls"
run: ls -la
3 changes: 0 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ if(DEFINED MSVC)
add_definitions(-D_USE_MATH_DEFINES)
endif()

if(NOT TARGET fmt)
find_package(fmt REQUIRED)
endif()

add_subdirectory(libtermbench)
add_subdirectory(tb)
42 changes: 42 additions & 0 deletions contour_results
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
All 35 tests finished.
---------------------

many_lines: 0.0394 seconds, 81.218 MB/s (normalized: 27.723 KB/s)
long_lines: 1.0236 seconds, 25.890 MB/s (normalized: 8.837 KB/s)
sgr_fg_lines: 0.0342 seconds, 93.567 MB/s (normalized: 31.938 KB/s)
sgr_fg_bg_lines: 0.0388 seconds, 82.474 MB/s (normalized: 28.151 KB/s)
binary: 0.0415 seconds, 77.108 MB/s (normalized: 26.320 KB/s)
0 chars per line: 5.0239 seconds, 6.108 MB/s (normalized: 2.085 KB/s)
1 chars per line: 3.0519 seconds, 9.093 MB/s (normalized: 3.104 KB/s)
2 chars per line: 2.0366 seconds, 13.525 MB/s (normalized: 4.617 KB/s)
3 chars per line: 1.0785 seconds, 17.927 MB/s (normalized: 6.119 KB/s)
4 chars per line: 1.0469 seconds, 21.784 MB/s (normalized: 7.435 KB/s)
5 chars per line: 1.0299 seconds, 24.634 MB/s (normalized: 8.409 KB/s)
6 chars per line: 1.0119 seconds, 28.597 MB/s (normalized: 9.761 KB/s)
7 chars per line: 0.0981 seconds, 32.620 MB/s (normalized: 11.134 KB/s)
8 chars per line: 0.0887 seconds, 36.077 MB/s (normalized: 12.314 KB/s)
9 chars per line: 0.0816 seconds, 39.216 MB/s (normalized: 13.386 KB/s)
0 chars with sgr per line: 0.0400 seconds, 80.000 MB/s (normalized: 27.307 KB/s)
1 chars with sgr per line: 0.0430 seconds, 74.419 MB/s (normalized: 25.402 KB/s)
2 chars with sgr per line: 0.0429 seconds, 74.592 MB/s (normalized: 25.461 KB/s)
3 chars with sgr per line: 0.0410 seconds, 78.049 MB/s (normalized: 26.641 KB/s)
4 chars with sgr per line: 0.0411 seconds, 77.859 MB/s (normalized: 26.576 KB/s)
5 chars with sgr per line: 0.0404 seconds, 79.208 MB/s (normalized: 27.036 KB/s)
6 chars with sgr per line: 0.0385 seconds, 83.117 MB/s (normalized: 28.371 KB/s)
7 chars with sgr per line: 0.0384 seconds, 83.333 MB/s (normalized: 28.444 KB/s)
8 chars with sgr per line: 0.0371 seconds, 86.253 MB/s (normalized: 29.441 KB/s)
9 chars with sgr per line: 0.0363 seconds, 88.154 MB/s (normalized: 30.090 KB/s)
0 chars with sgr and bg per line: 0.0347 seconds, 92.219 MB/s (normalized: 31.477 KB/s)
1 chars with sgr and bg per line: 0.0368 seconds, 86.957 MB/s (normalized: 29.681 KB/s)
2 chars with sgr and bg per line: 0.0355 seconds, 90.141 MB/s (normalized: 30.768 KB/s)
3 chars with sgr and bg per line: 0.0366 seconds, 87.432 MB/s (normalized: 29.843 KB/s)
4 chars with sgr and bg per line: 0.0345 seconds, 92.754 MB/s (normalized: 31.660 KB/s)
5 chars with sgr and bg per line: 0.0339 seconds, 94.395 MB/s (normalized: 32.220 KB/s)
6 chars with sgr and bg per line: 0.0342 seconds, 93.567 MB/s (normalized: 31.938 KB/s)
7 chars with sgr and bg per line: 0.0377 seconds, 84.881 MB/s (normalized: 28.973 KB/s)
8 chars with sgr and bg per line: 0.0358 seconds, 89.385 MB/s (normalized: 30.510 KB/s)
9 chars with sgr and bg per line: 0.0380 seconds, 84.211 MB/s (normalized: 28.744 KB/s)
all tests: 29.0819 seconds, 37.560 MB/s (normalized: 12.820 KB/s)

screen size: 100x30
data size: 32.000 MB
1 change: 0 additions & 1 deletion libtermbench/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ set_target_properties(termbench PROPERTIES
VERSION "${PROJECT_VERSION}"
SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}"
)
target_link_libraries(termbench PUBLIC fmt::fmt-header-only)

target_include_directories(termbench PUBLIC $<BUILD_INTERFACE:${${PROJECT_NAME}_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
Expand Down
Loading

0 comments on commit 49d5f1e

Please sign in to comment.