Skip to content

Commit

Permalink
Update performance scripts (#3532)
Browse files Browse the repository at this point in the history
* update performance script to work with out-of-source build
* update displayed messages and remove perf.rc file
* remove .gitignore in performance folder
  • Loading branch information
felixschurk committed Jul 4, 2024
1 parent eb22036 commit 85f52e3
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 19 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ add_subdirectory (scripts)
if (EXISTS ${CMAKE_SOURCE_DIR}/test)
add_subdirectory (test EXCLUDE_FROM_ALL)
endif (EXISTS ${CMAKE_SOURCE_DIR}/test)
if (EXISTS performance)
if (EXISTS ${CMAKE_SOURCE_DIR}/performance)
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)
foreach (doc_FILE ${doc_FILES})
Expand Down
3 changes: 0 additions & 3 deletions performance/.gitignore

This file was deleted.

9 changes: 7 additions & 2 deletions performance/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
cmake_minimum_required (VERSION 3.22)

add_custom_target (performance ./run_perf
configure_file(compare_runs.py compare_runs.py COPYONLY)
configure_file(load load)
configure_file(run_perf run_perf)

add_custom_target (performance ${CMAKE_BINARY_DIR}/performance/run_perf
DEPENDS task_executable
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/performance)
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/performance)


8 changes: 4 additions & 4 deletions performance/load
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if (open my $fh, '>', 'perf.rc')
close $fh;
}

my $filename = 'sample-text.txt';
my $filename = '${CMAKE_SOURCE_DIR}/performance/sample-text.txt';
open(my $fh, '<:encoding(UTF-8)', $filename)
or die "Could not open file '$filename' $!";

Expand All @@ -31,18 +31,18 @@ while (my $line = <$fh>)
if ($. % 20 == 19)
{
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 $?;
}
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 $?;
++$id;
}
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 $?;
}
}
Expand Down
16 changes: 8 additions & 8 deletions performance/run_perf
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
#! /bin/bash

echo 'Performance: setup'
rm -f ./pending.data ./completed.data ./undo.data ./backlog.data perf.rc
if [[ -e data/pending.data && -e data/completed.data ]]
rm -f ./taskchampion.sqlite3
if [[ -e ./data/taskchampion.sqlite3 ]]
then
echo ' - Using existing data'
echo ' - Using existing data.'
cp data/* .
else
echo ' - This step will take several minutes'
echo ' - Loading data. This step will take several minutes.'
./load
mkdir -p data
cp *.data perf.rc data
cp taskchampion.sqlite3 perf.rc data
fi

# Allow override.
if [[ -z $TASK ]]
then
TASK=../build/src/task
TASK=${CMAKE_BINARY_DIR}/src/task
fi

# Run benchmarks.
Expand Down Expand Up @@ -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"

echo ' - task import...'
rm -f ./pending.data ./completed.data ./undo.data ./backlog.data
$TASK rc.debug:1 rc:perf.rc import export.json 2>&1 | grep "Perf task"
rm -f ./taskchampion.sqlite3
$TASK rc.debug:1 rc:perf.rc import ${CMAKE_SOURCE_DIR}/performance/export.json 2>&1 | grep "Perf task"

echo 'End'
exit 0
Expand Down

0 comments on commit 85f52e3

Please sign in to comment.