Fandom

Mozilla Community

Firefox performance test/draft

217pages on
this wiki
Add New Page
Talk0 Share

extract each firefox version

$ cd /tmp; rm -rf firefox; tar zxf firefox-1.0.8.tar.gz; mv firefox ~/firefox-1.0.8
$ cd /tmp; rm -rf firefox; tar zxf firefox-1.5.0.12.tar.gz; mv firefox ~/firefox-1.5.0.12
$ cd /tmp; rm -rf firefox; tar zxf firefox-2.0.0.11.tar.gz; mv firefox ~/firefox-2.0.0.11

start firefox 1.0.8

$ ~/firefox-1.0.8/firefox -ProfileManager

create new profile named "1.0.8"

start firefox 1.5.0.12

$ ~/firefox-1.5.0.12/firefox -ProfileManager

create new profile named "1.5.0.12"

start firefox 2.0.0.11

$ ~/firefox-2.0.0.11/firefox -ProfileManager

create new profile named "2.0.0.11". In "Default Browser" dialog (when firefox start), uncheck "Always perform this check when starting firefox", and then click "No".

For each newly created firefox profile,

  • In Home Page preference, select Use Blank Page.
  • In Tabbed Browsing preference, select --> Open links from other applications in: --> a new tab in the most recent window.
  • Close all running firefox window of this profile.

Prepare text file, containing 0, 1, 10, ..., 100000 lines of "a", to be browsed by firefox,

$ perl -e 'for(1..0) { print "a\n"; }' > ~/public_html/a0.txt
$ perl -e 'for(1..1) { print "a\n"; }' > ~/public_html/a1.txt
$ perl -e 'for(1..10) { print "a\n"; }' > ~/public_html/a10.txt
$ perl -e 'for(1..100) { print "a\n"; }' > ~/public_html/a100.txt
$ perl -e 'for(1..1000) { print "a\n"; }' > ~/public_html/a1000.txt
$ perl -e 'for(1..10000) { print "a\n"; }' > ~/public_html/a10000.txt
$ perl -e 'for(1..100000) { print "a\n"; }' > ~/public_html/a100000.txt

Test to ensure the URL is working,

$ firefox http://127.0.0.1/~$USER/a100.txt

To avoid disturbing the display and keep the display environment unchanged during testing, the firefox will be tested in a separate display. Open new VNC session to test firefox,

$ vncserver -depth 24 -geometry 800x600 :2

Should ensure that screensaver is disabled in this session.

To view what's going on during testing (in viewonly mode to not disburb the display),

$ vncviewer -viewonly :2

Start the test,

$ DISPLAY=:2 perl -e 'foreach (
["about:blank", 200, 0.2],
["http://127.0.0.1/~$ENV{USER}/a0.txt", 200, 0.2],
["http://127.0.0.1/~$ENV{USER}/a1.txt", 200, 0.2],
["http://127.0.0.1/~$ENV{USER}/a10.txt", 200, 0.2],
["http://127.0.0.1/~$ENV{USER}/a100.txt", 200, 0.2],
["http://127.0.0.1/~$ENV{USER}/a1000.txt", 200, 0.2],
["http://127.0.0.1/~$ENV{USER}/a10000.txt", 200, 0.3],
["http://127.0.0.1/~$ENV{USER}/a100000.txt", 20, 2],
) { ($url, $count, $wait) = @$_; { use integer; $break = $count / 10; }
foreach $v (qw(1.0.8 1.5.0.12 2.0.0.11)) {
   $ffox_dir = "$ENV{HOME}/firefox-$v";
   system("killall $ffox_dir/firefox-bin"); sleep(1);

   system("$ffox_dir/firefox -P $v &"); sleep(2);
   $pid=`ps -o pid,args -C firefox-bin | grep -F $ffox_dir | awk '\''{print\$1}'\''`+0;
   # open another blank tab, to always show tab bar during testing.
   # This will eliminate the task of show/hide tab bar when testing.
   system("$ffox_dir/firefox about:blank"); sleep(2);

   $f = $url; $f =~ s|.*/||; $f = "utime-stime-vm-$v-${f}x$count.txt";
   open(F, ">", $f);
   # in linux 2.6.18, vm size is in 22th columns ([21]) of /proc/pid/stat
   #($sec,$syssec,$kbyte) = (split(/\s+/, `cat /proc/$pid/stat`, -1))[13,14,22];
   #$sec/=100; $syssec/=100; $kbyte/=1024; print F "$sec $syssec $kbyte\n";
   ($sec,$syssec) = (split(/\s+/, `cat /proc/$pid/stat`, -1))[13,14];
   $kbyte = (split(/\s+/, `grep -i vmsize /proc/$pid/status`, -1))[1];
   $sec/=100; $syssec/=100; print F "$sec $syssec $kbyte\n";
   for (1..$count) {
      system("$ffox_dir/firefox $url"); # this will open the url in new tab
      select(undef,undef,undef,$wait); # wait for url to be completely rendered
      # press ctrl-w to close the tab
      system("xte", "keydown Control_R", "key w", "keyup Control_R");

      # periodically check for cpu/mem usage of firefox
      $_ % $break == 0 or next; sleep(2);
      ($sec,$syssec) = (split(/\s+/, `cat /proc/$pid/stat`, -1))[13,14];
      $kbyte = (split(/\s+/, `grep -i vmsize /proc/$pid/status`, -1))[1];
      $sec/=100; $syssec/=100; print F "$sec $syssec $kbyte\n";
   } sleep(2);
   ($sec,$syssec) = (split(/\s+/, `cat /proc/$pid/stat`, -1))[13,14];
   $kbyte = (split(/\s+/, `grep -i vmsize /proc/$pid/status`, -1))[1];
   $sec/=100; $syssec/=100; print F "$sec $syssec $kbyte\n";
   close(F);

   # safely quit firefox, so that firefox2 will not ask to restore session next
   # time
   system("xte", "keydown Control_R", "key w", "keyup Control_R"); sleep(1);
   system("xte", "keydown Control_R", "key w", "keyup Control_R"); sleep(1);
   system("killall $ffox_dir/firefox-bin"); sleep(1);
} }'

Prerequisite Edit

  • apache web server
  • "xte" command that come with software called "xautomation"
  • linux version that support /proc/pid/stat (e.g., 2.6.8, 2.6.15, 2.6.18)

Weak prerequisite Edit

  • vncserver or Xnest
  • vncviewer

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.