Update performance scripts (#3532)

* update performance script to work with out-of-source build
* update displayed messages and remove perf.rc file
* remove .gitignore in performance folder
This commit is contained in:
Felix Schurk 2024-07-04 08:45:42 +02:00 committed by GitHub
parent eb22036f6b
commit 85f52e3630
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 22 additions and 20 deletions

View file

@ -149,9 +149,9 @@ add_subdirectory (scripts)
if (EXISTS ${CMAKE_SOURCE_DIR}/test) if (EXISTS ${CMAKE_SOURCE_DIR}/test)
add_subdirectory (test EXCLUDE_FROM_ALL) add_subdirectory (test EXCLUDE_FROM_ALL)
endif (EXISTS ${CMAKE_SOURCE_DIR}/test) endif (EXISTS ${CMAKE_SOURCE_DIR}/test)
if (EXISTS performance) if (EXISTS ${CMAKE_SOURCE_DIR}/performance)
add_subdirectory (performance EXCLUDE_FROM_ALL) add_subdirectory (performance EXCLUDE_FROM_ALL)
endif (EXISTS performance) endif (EXISTS ${CMAKE_SOURCE_DIR}/performance)
set (doc_FILES ChangeLog README.md INSTALL AUTHORS COPYING LICENSE) set (doc_FILES ChangeLog README.md INSTALL AUTHORS COPYING LICENSE)
foreach (doc_FILE ${doc_FILES}) foreach (doc_FILE ${doc_FILES})

View file

@ -1,3 +0,0 @@
*.data
*.rc
export.json

View file

@ -1,6 +1,11 @@
cmake_minimum_required (VERSION 3.22) cmake_minimum_required (VERSION 3.22)
add_custom_target (performance ./run_perf configure_file(compare_runs.py compare_runs.py COPYONLY)
DEPENDS task_executable configure_file(load load)
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/performance) configure_file(run_perf run_perf)
add_custom_target (performance ${CMAKE_BINARY_DIR}/performance/run_perf
DEPENDS task_executable
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/performance)

View file

@ -14,7 +14,7 @@ if (open my $fh, '>', 'perf.rc')
close $fh; close $fh;
} }
my $filename = 'sample-text.txt'; my $filename = '${CMAKE_SOURCE_DIR}/performance/sample-text.txt';
open(my $fh, '<:encoding(UTF-8)', $filename) open(my $fh, '<:encoding(UTF-8)', $filename)
or die "Could not open file '$filename' $!"; or die "Could not open file '$filename' $!";
@ -31,18 +31,18 @@ while (my $line = <$fh>)
if ($. % 20 == 19) if ($. % 20 == 19)
{ {
my $anno_id = $id - 1; my $anno_id = $id - 1;
qx{../build/src/task rc:perf.rc rc.gc=off $anno_id annotate $line}; qx{${CMAKE_BINARY_DIR}/src/task rc:perf.rc rc.gc=off $anno_id annotate $line};
print "[$.] task rc:perf.rc rc.gc=off $anno_id annotate $line\n" if $?; print "[$.] task rc:perf.rc rc.gc=off $anno_id annotate $line\n" if $?;
} }
elsif ($. % 4 == 1) elsif ($. % 4 == 1)
{ {
qx{../build/src/task rc:perf.rc rc.gc=off add $line}; qx{${CMAKE_BINARY_DIR}/src/task rc:perf.rc rc.gc=off add $line};
print "[$.] task rc:perf.rc rc.gc=off add $line\n" if $?; print "[$.] task rc:perf.rc rc.gc=off add $line\n" if $?;
++$id; ++$id;
} }
else else
{ {
qx{../build/src/task rc:perf.rc rc.gc=off log $line}; qx{${CMAKE_BINARY_DIR}/src/task rc:perf.rc rc.gc=off log $line};
print "[$.] task rc:perf.rc rc.gc=off log $line\n" if $?; print "[$.] task rc:perf.rc rc.gc=off log $line\n" if $?;
} }
} }

View file

@ -1,22 +1,22 @@
#! /bin/bash #! /bin/bash
echo 'Performance: setup' echo 'Performance: setup'
rm -f ./pending.data ./completed.data ./undo.data ./backlog.data perf.rc rm -f ./taskchampion.sqlite3
if [[ -e data/pending.data && -e data/completed.data ]] if [[ -e ./data/taskchampion.sqlite3 ]]
then then
echo ' - Using existing data' echo ' - Using existing data.'
cp data/* . cp data/* .
else else
echo ' - This step will take several minutes' echo ' - Loading data. This step will take several minutes.'
./load ./load
mkdir -p data mkdir -p data
cp *.data perf.rc data cp taskchampion.sqlite3 perf.rc data
fi fi
# Allow override. # Allow override.
if [[ -z $TASK ]] if [[ -z $TASK ]]
then then
TASK=../build/src/task TASK=${CMAKE_BINARY_DIR}/src/task
fi fi
# Run benchmarks. # Run benchmarks.
@ -45,8 +45,8 @@ $TASK rc.debug:1 rc:perf.rc export >/dev/null 2>&1
$TASK rc.debug:1 rc:perf.rc export 2>&1 >export.json | grep "Perf task" $TASK rc.debug:1 rc:perf.rc export 2>&1 >export.json | grep "Perf task"
echo ' - task import...' echo ' - task import...'
rm -f ./pending.data ./completed.data ./undo.data ./backlog.data rm -f ./taskchampion.sqlite3
$TASK rc.debug:1 rc:perf.rc import export.json 2>&1 | grep "Perf task" $TASK rc.debug:1 rc:perf.rc import ${CMAKE_SOURCE_DIR}/performance/export.json 2>&1 | grep "Perf task"
echo 'End' echo 'End'
exit 0 exit 0