Preloading Thunderbird

From openSUSE

This is from the SUPER Project. I have just applied it to Thunderbird.

See Preloading Internals for all the details on preloading.

Grab parse_strace put it somewhere you can find. Or paste the following script in a file named parse_strace

parse_strace

#!/bin/bash

test -z $1 && exit -1

#remove all references to private data: /home/ /root/ /tmp/
#remove all references to not cachable file systems: /proc/ /dev/ /sys/
#grep for "/" at the end in case some unwanted lines slipped through


#filter out everything where (l)stat(64) was called
grep stat ./"$1" | grep -v ENOENT | grep -v fstat \
    | grep -v /proc/ | grep -v /dev/ | grep -v /sys/ \
    | grep -v /home/ | grep -v /root/ | grep -v /tmp/ \
    | grep / | sed 'sI^.*("II' | sed 'sI".*II' \
    | sort | uniq | grep / | sed 'sI^/Istat /I' > "$1_statted"

#filter out everything where a file was opened
grep -v stat ./"$1" | grep open | grep -v ENOENT \
    | grep -v /proc/ | grep -v /dev/ | grep -v /sys/ \
    | grep -v /home/ | grep -v /root/ | grep -v /tmp/ \
    | grep / | sed 'sI^.*("II' | sed 'sI".*II' \
    | sort | uniq | grep / | sed 'sI^/Iopen /I' > "$1_opened"


#sort them according to path: fewer head movements on the disk
#uniq them: if there is an "open" and a "stat" entry for the same file,
#only the "open" will stay there, no reason to do an extra-stat
cat "$1_statted" "$1_opened" | sort -k 2 | uniq --skip-fields=1 > "$1_preload"

Preload Steps

  1. install preload
  2. install latest thunderbird
  3. make a temp directory
  4. change to temp directory
  5. use strace to profile thunderbird
  6. switch to root
  7. use the parse_strace script to generate a preload script (see above script)
  8. update the preload cache
  9. move the preload script
  10. update the apps preloader script

yast2 --install preload
yast2 --install thunderbird
mkdir /tmp/preload_tbird
cd /tmp/preload_tbird
strace -fF -e open,process thunderbird 2>thunderbird_strace
su -
sh parse_strace thunderbird_strace
mv thunderbird_strace_preload /etc/preload.d/thunderbird
update_preload
echo 'preload /usr/bin/thunderbird "thunderbird"' >> /usr/bin/appspreloader.sh