mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-11 18:32:20 +08:00
fa50657af1
Summary: We want to be able to benchmark initial sync, so this diff adds two scripts. The first, drop-stuff.sh, drops all data from the app and sync databases that isn't related to account credentials. The second, benchmark-initial-sync.sh, runs a fixed number of iterations (current 5) that invokes drop-stuff.sh then opens the app, waits a fixed amount of time (currently 120 seconds), and then kills the app and measures how many messages it synced which it prints to the console. This is sufficient for us to start measuring how quickly we can sync messages. This diff also includes the sqlite3 amalgamation which drop-stuff.sh requires to function correctly due to depending on the FTS5 extension which doesn't come built-in on some platforms. Test Plan: Run benchmark locally Reviewers: evan, spang, juan Reviewed By: juan Differential Revision: https://phab.nylas.com/D4275
53 lines
1.3 KiB
Bash
53 lines
1.3 KiB
Bash
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
function print_help {
|
|
OUTPUT=$(cat <<- EOM
|
|
|
|
A script to benchmark the initial sync performance of Nylas Mail. To use,
|
|
simply run the script after authing whatever accounts you wish to measure
|
|
in your development version of Nylas Mail. The benchmarking script will
|
|
clear all of the data except for your accounts and open and close Nylas
|
|
Mail several times, printing out the number of messages synced after each
|
|
iteration.
|
|
)
|
|
echo "$OUTPUT"
|
|
}
|
|
|
|
if [[ $1 == '-h' || $1 == '--help' ]]
|
|
then
|
|
print_help
|
|
exit 0
|
|
fi
|
|
|
|
# Run sudo to prime root privileges
|
|
sudo ls > /dev/null
|
|
|
|
CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
NYLAS_DIR="$HOME/.nylas-dev"
|
|
EDGEHILL_DB="$NYLAS_DIR/edgehill.db"
|
|
TIME_LIMIT=120
|
|
ITERS=5
|
|
|
|
for i in `seq 1 $ITERS`
|
|
do
|
|
bash $CWD/drop-data-except-accounts.sh > /dev/null
|
|
|
|
(npm start &> /dev/null &)
|
|
|
|
sleep $TIME_LIMIT
|
|
|
|
ELECTRON_PID=`ps aux | grep "Electron packages/client-app" | grep -v grep | awk '{print $2}'`
|
|
sudo kill -9 $ELECTRON_PID
|
|
|
|
MESSAGE_COUNT=`sqlite3 $EDGEHILL_DB 'SELECT COUNT(*) FROM Message'`
|
|
echo "Synced Messages: $MESSAGE_COUNT"
|
|
|
|
# Sometimes it takes a while to shutdown
|
|
while [[ $ELECTRON_PID != '' ]]
|
|
do
|
|
sleep 1
|
|
ELECTRON_PID=`ps aux | grep "Electron packages/client-app" | grep -v grep | awk '{print $2}'`
|
|
done
|
|
done
|