Sonntag, 11. Januar 2009

FireFox on Steroids :) Firefox 3 Optimierung


batch datei speichern im firefox profil zusammen mit der sqlite3 datei

> BATch Datei , cmd Befehle in Windows (DOS)

vaccumfirefox3.bat

@echo off

if not exist fixcount.txt echo J > fixcount.txt

FIND "A" fixcount.txt
IF ERRORLEVEL 1 GOTO none
IF ERRORLEVEL 0 GOTO zero
:none
FIND "B" fixcount.txt
IF ERRORLEVEL 1 GOTO ntwo
IF ERRORLEVEL 0 GOTO one
:ntwo
FIND "C" fixcount.txt
IF ERRORLEVEL 1 GOTO nthree
IF ERRORLEVEL 0 GOTO two
:nthree
FIND "D" fixcount.txt
IF ERRORLEVEL 1 GOTO nfour
IF ERRORLEVEL 0 GOTO three
:nfour
FIND "E" fixcount.txt
IF ERRORLEVEL 1 GOTO nfive
IF ERRORLEVEL 0 GOTO four
:nfive
FIND "F" fixcount.txt
IF ERRORLEVEL 1 GOTO nsix
IF ERRORLEVEL 0 GOTO five
:nsix
FIND "G" fixcount.txt
IF ERRORLEVEL 1 GOTO nseven
IF ERRORLEVEL 0 GOTO six
:nseven
FIND "H" fixcount.txt
IF ERRORLEVEL 1 GOTO neight
IF ERRORLEVEL 0 GOTO seven
:neight
FIND "I" fixcount.txt
IF ERRORLEVEL 1 GOTO nnine
IF ERRORLEVEL 0 GOTO eight
:nnine
FIND "J" fixcount.txt
IF ERRORLEVEL 1 GOTO error
IF ERRORLEVEL 0 GOTO nine

:error
ECHO There was some error.
GOTO exit

:zero
Echo "Cleaned one run ago"
echo B > fixcount.txt
Goto exit

:one
Echo "Cleaned two runs ago"
echo C > fixcount.txt
Goto exit

:two
Echo "Cleaned three runs ago"
echo D > fixcount.txt
Goto exit

:three
Echo "Cleaned four runs ago"
echo E > fixcount.txt
Goto exit

:four
Echo "Cleaned five runs ago"
echo F > fixcount.txt
Goto exit

:five
Echo "Cleaned six runs ago"
echo G > fixcount.txt
Goto exit

:six
Echo "Cleaned seven runs ago"
echo H > fixcount.txt
Goto exit

:seven
Echo "Cleaned eight runs ago"
echo I > fixcount.txt
Goto exit

:eight
Echo "Cleaned nine runs ago"
echo J > fixcount.txt
Goto exit

:nine
Echo "Cleaning"
echo A > fixcount.txt
for %%i in (*.sqlite) do @echo VACUUM; | sqlite3 %%i
Goto exit

:exit

start "" """C:\Programme\Mozilla Firefox\firefox.exe"

exit

For windows:
* get sqlite3 from here:
* http://www.sqlite.org/sqlite-3_6_10.zip
* http://www.sqlite.org/sqlitedll-3_6_10.zip
* unzip them both into c:windowssystem32
* cd to your profile directory (there may be an easier way to specify this from the

commandline, but I don't know cmd globbing that well)
* for %f in (*sqlite) do sqlite3 %f "VACUUM;"
* note: quotes instead of apostrophes

Da der Firefox 3 SQLite Datenbanken für so ziemlich alles verwendet, bringt es durchaus Performancevorteile wenn man die zwischendurch optimiert. Unter Linux Unix muss man dafür das sqlite3-Paket installiert haben, den Kommandozeilenclient für SQLite Datenbanken. Das Optimieren ist ganz einfach:

Der Befehl sorgt dafür das SQLite die Datenbanken von Sachen befreit die schon längt gelöscht wurden, wie viele andere Dateibasirende Datenbanken gibt auch SQLite seinen schon belegten Speicher nicht einfach so frei. Erst durch VACUUM wird das erledigt, welches Firefox dummerweise nicht selbst macht.

Zuvor sollte Firefox unbedingt beendet werden!

Das hat mir bei meinem Firefox ca. 30 MByte mehr freien Platz gebracht, und natürlich hakt Firefox nichtmehr so sehr wenn man mal in der History rumwühlt.

for f in ~/.mozilla/firefox/*/*.sqlite; do sqlite3 $f 'VACUUM;'; done

cd .mozilla/firefox/[Profilkennung]
for i in *.sqlite; do echo "VACUUM;" | sqlite3 $i ; done

  • For Linux
    $ for i in *.sqlite; do echo "VACUUM;" | sqlite3 $i ; done
  • For Windows
    for %i in (*.sqlite) do @echo VACUUM; | sqlite3 %i
Für Windows

sqlite-3 downloaden downloaden und in den Firefox profil ordner entpacken
Ins Verzeichins gehen vom firefox

C:\Dokumente und Einstellungen\benuztername\Anwendungsdaten\Mozilla\Firefox\Profiles\[Profilkennung]
und for %i in (*.sqlite) do @echo VACUUM; | sqlite3 %i

eingeben.

get SQLite Database Browser v1.3 (nothing to do with firefox) and then load your places.sqlite into it and then choose File > Compact Database. That might save you some space without loosing any of your data.

edit: of course, backup your places.sqlite file up somewhere before you compact it.


While FF is NOT running, check and see if your profile contains files in "bookmarkbackups", named thus: "bookmarks-2008-06-06.json". If you do have one then you don't need to make a new backup, you'll just use one of the Firefox-saved ones. (But this might be a brand new feature, maybe even newer than RC2... I'm personally running FF 3.1 test builds already, and don't know exactly when this Feature was put in.)

(B) If you don't have such a file, bring up firefox and save your bookmark to a "json" backup file. (NOT a mere "html" file, that's for exporting to non-Firefox browsers and it loses all your tags.) Then terminate Firefox

(C) One way or the other, you've now got a "*.json" backup file for your bookmarks. Now, while Firefox is not running, rename your "places.sqlite file to something else. (Like maybe, "places-dot-sqlite-saved-in-case-this-doesnt-work.old" :wink: .) Start up Firefox, it should create a new but empty "places.sqlite" file. Go to Bookmarks --> Organize Bookmarks and click "Backup/Restore". Use "Restore" with either the latest Firefox-built JSON file, or use "choose" to load from the one you made in step (A).

Your resulting "places.sqlite" should be MUCH smaller, and if you've set your "maximum days to keep in history" to an aggressive value, then it should stay that way. If it worked, go ahead and delete "places-dot-sqlite-saved-in-case-this-doesnt-work.old", which you can do even while FF is running.


doing an "Vaccum" / "Compact" function on the SQLite files of the profile
improves the performance at lot

Do you have the new security features

Tell me if the site I'm visiting is a suspected attack side
Tell me if the stie I'm viviting is a suspected forgery

active?

Then first change the preference

urlclassifier.updatecachemax from -1 to 104857600

(via using about:config).

The following SQLite file are part of your profile:

Verzeichnis von S:\mof-3000\mozilla\firefox\Profiles\5eqjlbn3.default

26.06.08 2.28 7168 0 content-prefs.sqlite
26.06.08 11.39 20480 0 cookies.sqlite
26.06.08 2.30 10240 0 downloads.sqlite
26.06.08 11.39 9216 0 formhistory.sqlite
26.06.08 2.31 2048 0 permissions.sqlite
26.06.08 11.39 3837952 0 places.sqlite
26.06.08 2.31 2048 0 search.sqlite
26.06.08 11.37 34660352 0 urlclassifier3.sqlite
8 Datei(en) 38549504 Byte belegt

Verzeichnis von
S:\mof-3000\mozilla\firefox\Profiles\5eqjlbn3.default\OfflineCache

22.06.08 19.46 4096 0 index.sqlite
1 Datei(en) 4096 Byte belegt



As you see, the file urlclassifier3.sqlite ist currenty 34 MB big.

This file is growing from 0 ( at creation of the profile )
to about 56 MB (before Vaccum/Ccmpact ) at my installation.

There is clear a need to "Vaccum" this file after creation of
a profile and first few surf sessions.



Hwoto to shrink / vacuum / compact the SQLite file.


1. Manual Way

1.1 Get the application SQLiteBrowse from sourceforge.net


http://sourceforge.net/project/showfiles.php?group_id=87946&package_id=91778&release_id=414746

Install the application on your system

1.2 shut down Firefox 3.0

1.3 save your current profile

1.4 Start the SQLite Browser

Open DB S:\mof-3000\mozilla\firefox\Profiles\5eqjlbn3.default\
urlclassifier3.sqlite

select menu Menue "File/Compact Database"

function processes at my installation about 1 min

Than the meassage box " compact done" is display with okay bottom

caveat: at the current version of SQLiteBrowser 1.3b
the cursor is still at "clock - Busy indicator -
but click to bottom okay works on my installation


Close the DB.

Repeat the procedure for the rest of the SQLite files of your profile

at my installation after 3 day of surfing,

the vacuum / compact function shrinks the

file urlclassifier3.sqlite from 56 MB to 34 MB


1.5 Do a test with Firefox 3.0

performance of your system? :-)





The RxSql package 2.5 is at SQLite 3.3.x

The SQLite is currently at SQLite 3.5.9 according project





References:
==============

Bug 439340 – Background cleanup actions block desktop on OS/2
https://bugzilla.mozilla.org/show_bug.cgi?id=439340

Firefox 3.0: Blockien des Systems durch minutenlange hohe HDD I/O Aktivität" - Workaround
http://de.os2.org/forum/diskussion/index.php3?all=116554

http://www.sqlite.org/

http://sqlitebrowser.sourceforge.net/index.html

http://www.sqlite.org/lang_vacuum.html

http://rexxsql.sourceforge.net/



Firefox/Tuning

Hier einige Optimierungsvorschläge um den Firefox zu beschleunigen.Die Datei user.js erstellen im Firefox profil.
Linux
cd .mozilla/firefox/[Profilkennung]
nano user.js
Windows


C:\Dokumente und Einstellungen\benuztername\Anwendungsdaten\Mozilla\Firefox\Profiles\[Profilkennung]
und folgendes einfügen

#tweaked firefox user.js
user_pref("content.interrupt.parsing", true);
user_pref("content.max.tokenizing.time", 2250000);
user_pref("content.notify.interval", 750000);
user_pref("content.notify.ontimer", true);
user_pref("content.switch.threshold", 750000);
user_pref("nglayout.initialpaint.delay", 0);
user_pref("network.http.max-connections", 48);
user_pref("network.http.max-connections-per-server", 16);
user_pref("network.http.max-persistent-connections-per-proxy", 16);
user_pref("network.http.max-persistent-connections-per-server", 8);
user_pref("browser.cache.memory.capacity", 65536);
user_pref("ui.submenuDelay", 0);
user_pref("network.dns.disableIPv6", true);
user_pref("mousewheel.withnokey.numlines", 15);
user_pref("mousewheel.withnokey.sysnumlines", false);

Turning off anti-phishing to speedup Firefox

The anti-phishing features of Firefox may cause Firefox to become slow to start or exit, and might also affect the browsing speed since Firefox apparently contacts google for every http request. The problem is that Firefox maintains a sqlite database that might grow quite big, and reading and writing to this database begins to take some time when it grows bigger. If you feel that you don't need Firefox to tell you which sites may be suspect you can disable this feature:

  1. Turn off the following options under the security tab in preferences: "Tell me if the site I'm visiting is a suspected Attack site" and "Tell me if the site I'm visiting is a suspected forgery".
  2. Delete all files beginning with urlclassifier in your profile folder (~/.mozilla/firefox/********.default where ******** is some combination of letters and numbers. default might be something else if you have created a non-default profile). Some of these files might be recreated by Firefox, but they won't grow any larger than their initial size.
rm -i ~/.mozilla/firefox/*.default/urlclassifier*

IPv6 deaktivieren

Es kann unter gewissen Netzwerkkonstellationen vorkommen, dass Firefox bei aktivierter IPv6-Unterstützung sehr langsam ist, oder seiten gar nicht geladen werden können. Um die IPv6-Funktion zu deaktivieren, muss man den entsprechenden Wert über „about:config“ auf „true“ setzen.

network.dns.disableIPv6

Sollte der Seitenaufruf allerdings funktionieren, sollte man diese Option so belassen, wie sie ist. Durch das deaktivieren der IPv6-unterstützung in Firefox erhält man keine Vorteile, wenn es auch mit aktivierter unterstützung funktioniert.


Firefox Tweaks

Speed Up Firefox Web Browser Tips

  • Applications -> Internet -> Firefox Web Browser
  • Mozilla Firefox
Address Bar -> about:config
Filter: ->
network.dns.disableIPv6 -> true
network.http.pipelining -> true
network.http.pipelining.maxrequests -> 8
network.http.proxy.pipelining -> true
  • Restart Mozilla Firefox

How to disable beep sound for link find function in Mozilla Firefox

  • Applications -> Internet -> Firefox Web Browser
  • Mozilla Firefox
Address Bar -> about:config
Filter: accessibility.typeaheadfind.enablesound -> false
  • Restart Mozilla Firefox

Setting the backspace button to go to a previous page

  • Applications -> Internet -> Firefox Web Browser
  • Mozilla Firefox
Address Bar -> about:config
Filter: -> browser.backspace_action -> 0
  • Restart Mozilla Firefox

Close the Download dialog quicker

  • Go to Applications -> Internet -> Firefox Web Browser
  • Put in your address bar
Address Bar -> about:config

Filter the configs options

Filter: -> alerts.totalOpenTime -> 500

Reduce the quantity of popups

  • Load Mozilla Firefox
  • Applications -> Internet -> Firefox Web Browser
  • Put in your address bar
Address Bar -> about:config
  • Filter the config options and change it to a reasonable number
Filter: -> dom.popup_maximum -> 5

Hide the Go Button

  • Load Mozilla Firefox
  • Applications -> Internet -> Firefox Web Browser
  • Put in your address bar
Address Bar -> about:config
  • Filter the config options and double click so it changes the result
browser.urlbar.hideGoButton -> Yes

Speed improvements using tmpfs

  • Load Mozilla Firefox
  • Applications -> Internet -> Firefox Web Browser
  • Put in your address bar
Address Bar -> about:config
  • Right click anywhere in the browser window and select
New -> String
  • Type in:
browser.cache.disk.parent_directory
  • press OK, and type in the new window:
/tmp



Step 1. Reduce the size of your profile directory.





tmpfs is RAM-backed, so we want to conserve memory by trimming the fat
from the profile. I recommend making the following config changes
(enter 'about:config' in the Firefox address bar):





set browser.cache.disk.capacity to 20000 or thereabouts


set browser.safebrowsing.enabled to false


set browser.safebrowsing.malware.enabled to false




The first one reduces the size of the disk cache to about 20 MB,
down from 50MB. It might be tempting to turn disk cache off entirely,
but I've encountered poor performance doing that in the past; I think
that the caching algorithm has to be able to push things into disk
cache for best performance, even if they won't stay there long.




The last two disable the collection of the information in the
'urlclassifier*.sqlite' files. These hold Firefox's database of
suspected malware or phishing sites, and while most users will feel
comfortable turning this off, it does in theory leave you more
vulnerable to these types of attacks. There's a known bug in Firefox
which can make these files grow quickly; on my system, they were 70MB
total.




After you've changed these settings, clear the cache in Firefox and
delete the urlclassifier*.sqlite files from your profile directory.
(SQLite will recreate empty databases but they'll stay at 32k.) My
profile is about 54MB in total size now, which is quite reasonable.





Step 2. Edit the fstab and prepare the backup tarball.





First, create a tarball of your profile as it currently stands.





Code:
$ cd
$ cd .mozilla/firefox
$ tar cpf packed.tar abcd1234.default


abcd1234.default should be replaced by your profile directory name here and below.

Now edit /etc/fstab and add a line like this:

Code:
firefox /home/steven/.mozilla/firefox/abcd1234.default tmpfs size=128M,noauto,user,exec,uid=1000,gid=100 0 0


You'll have to adjust path components, uid and gid.

Step 3. Set up a backup and restore script.

This is an example, but is by no means the only way to do it. I'll assume you've named the script "${HOME}/.pack_ffox.sh" in future commands, so replace that with whatever you decide to do.

Code:
#!/bin/bash

# Change this to match your correct profile
PROFILE="abcd1234.default"

cd "${HOME}/.mozilla/firefox"

if test -z "$(mount | grep -F "${HOME}/.mozilla/firefox/${PROFILE}" )"
then
mount "${HOME}/.mozilla/firefox/${PROFILE}"
fi

if test -f "${PROFILE}/.unpacked"
then
tar --exclude '.unpacked' -cpf packed.tmp.tar "$PROFILE"
mv packed.tar packed.tar.old
mv packed.tmp.tar packed.tar
else
tar xpf packed.tar &&\
touch "${PROFILE}/.unpacked"
fi



This script will load your firefox profile if it hasn't been loaded, and save it otherwise (keeping one backup copy from a few minutes ago in case of file corruption or the like). Once you've got it saved, you'll need to quit Firefox for this next step. Open in links, copy and paste to a text editor, or just remember the steps.

Step 4. Switch over.

With Firefox closed, you need to empty your profile directory. Either move the files currently in there to a new folder, or simply erase them (remember, a copy is in packed.tar as well). Be sure to leave the empty profile directory there for the tmpfs mount point.

Now, run the script:
Code:
$ "${HOME}/.pack_ffox.sh"


Verify that your profile directory is now mounted on tmpfs, that your files got correctly unpacked, and that the file .unpacked exists inside of your profile directory.

Now run the script again, exactly as before. This time, it will detect that your profile's been unpacked and is ready to use, and create a new packed.tar. If it worked, you should now have the file ".mozilla/firefox/packed.old.tar" as well.

If both of those things checked out, you're clear to start Firefox again.

I recommend adding the command to your .xinitrc or desktop-environment-specific startup settings, so that it's ready to go when you log in. It's also critical that you run it again before you shut down your computer, or you'll lose all changes. One of the safest ways for users on media that doesn't have limited write-cycles is to simply add an entry to the crontab which runs the script every five minutes. Run this command to edit the crontab:

Code:
# crontab -u USERNAME -e


which will bring up your editor. Add a line akin to this one:

Code:
*/5 * * * * $HOME/.pack_ffox.sh


Check in five minutes to make sure the mtime of packed.tar has changed, indicating that the script is working.
user_pref("config.trim_on_minimize", true);
user_pref("content.interrupt.parsing", true);
user_pref("content.max.tokenizing.time", 2250000);
user_pref("content.maxtextrun", 8191);
user_pref("content.notify.backoffcount", 5);
user_pref("content.notify.interval", 750000);
user_pref("content.notify.ontimer", true);
user_pref("content.switch.threshold", 750000);

user_pref("network.http.max-connections", 48);
user_pref("network.http.max-connections-per-server", 32);
user_pref("network.http.max-persistent-connections-per-proxy", 20);
user_pref("network.http.max-persistent-connections-per-server", 20);

user_pref("network.http.pipelining", true);
user_pref("network.http.pipelining.firstrequest", true);
user_pref("network.http.proxy.pipelining", true);
user_pref("network.http.pipelining.maxrequests", 8);
user_pref("nglayout.initialpaint.delay", 100);

user_pref("network.http.keep-alive", true);
user_pref("network.http.keep-alive.timeout", 600);
user_pref("network.http.request.max-start-delay", 10);
user_pref("network.dnsCacheExpiration", 3600);
user_pref("network.dnsCacheEntries", 1000);

user_pref("browser.sessionhistory.max_total_viewers", 3);
-----------------------------------------------------------------
* This pertains to the tweak contained in the above Speed Tweaks

user_pref("config.trim_on_minimize", true);

Setting this to true may slow down maximizing from the tray if FireFox depending on the users computers memory. Set it to false if you find that FireFox is slow to maximize from the tray.

------------------------------------------------------------

This tweak will disable favicons in the NewsFox Extension.

user_pref("newsfox.advanced.favicons", false);
-------------------------------------------------------------------------
Some minor privacy/security tweaks for those into that sort of thing.

user_pref("browser.cache.disk_cache_ssl", false);

user_pref("browser.microsummary.enabled", false);
user_pref("browser.microsummary.updateGenerators", false);
--------------------------------------------------------
Now this tweak depends on how much ram a user has installed so check the specs below and adjust the value accordingly. These are from Fx v2 but I have read of no changes in memory values for Fx v3 beta and these work fine for me. YMMV so experiment.

user_pref("browser.cache.memory.capacity", 18432);
------------------------------
Usable values:

Physical RAM Memory Cache (in KB)
32 MB 2048
64 MB 4096
128 MB 6144
256 MB 10240
512 MB 14336
1 GB 18432
2 GB 24576
4 GB 30720
8 GB and up 32768

Do not cache decoded images and chrome in memory. 0
---------------------------------------------------
GUI Tweaks to hide or show things or keep them from starting.

user_pref("browser.chrome.favicons", false);
user_pref("browser.chrome.site_icons", false);
user_pref("browser.display.show_image_placeholders", true);

user_pref("accessibility.accesskeycausesactivation", false);
user_pref("accessibility.typeaheadfind.enablesound", false);
user_pref("accessibility.typeaheadfind.autostart", false);
user_pref("accessibility.typeaheadfind", false);
-----------------------------------------------------
The new Awesome Bar feature may not be liked by some so it can be tweaked a bit.

user_pref("browser.urlbar.maxRichResults", 20);

Default is 25

user_pref("browser.urlbar.matchOnlyTyped", false);

Setting this to true will only search for previously typed addresses.

If the user really wants the old Fx v2 address bar use the Old Bar extension available from here.

»https://addons.mozilla.org/en-US/firefox/addon/6227
-------------------------------------------------------
Seeing how the new Awesome Bar (Address Bar) is not hitting it off with some here is another tweak.

Disable the AwesomeBar and make the Fx v3 Address Bar work like the Fx v2 Address Bar series.

Type about:config in the address bar (Enter)

Filter to:

browser.urlbar.maxRichResults

Set the value to "0" w/out quotes.

From MoFo:

quote:Setting the preference to 0 effectively disables the Location Bar dropdown entirely.

-------------------------------------------------------

Make sure you restart Fx after applying any of the tweaks and if they do not take check your entries in the user.js to make sure you did not miss any punctuation.



Tweaking for Speed - Firefox v3 Series



user.js
user_pref("network.dns.disableIPv6", true);
user_pref("mousewheel.withnokey.numlines", 15);
user_pref("mousewheel.withnokey.sysnumlines", false);
user_pref("config.trim_on_minimize", true);
user_pref("content.interrupt.parsing", true);
user_pref("content.max.tokenizing.time", 2250000);
user_pref("content.maxtextrun", 8191);
user_pref("content.notify.backoffcount", 5);
user_pref("content.notify.interval", 750000);
user_pref("content.notify.ontimer", true);
user_pref("content.switch.threshold", 750000);

user_pref("network.http.max-connections", 48);
user_pref("network.http.max-connections-per-server", 32);
user_pref("network.http.max-persistent-connections-per-proxy", 20);
user_pref("network.http.max-persistent-connections-per-server", 20);

user_pref("network.http.pipelining", true);
user_pref("network.http.pipelining.firstrequest", true);
user_pref("network.http.proxy.pipelining", true);
user_pref("network.http.pipelining.maxrequests", 8);
user_pref("nglayout.initialpaint.delay", 100);

user_pref("network.http.keep-alive", true);
user_pref("network.http.keep-alive.timeout", 600);
user_pref("network.http.request.max-start-delay", 10);
user_pref("network.dnsCacheExpiration", 3600);
user_pref("network.dnsCacheEntries", 1000);
user_pref("newsfox.advanced.favicons", false);
user_pref("browser.cache.disk_cache_ssl", false);

user_pref("browser.microsummary.enabled", false);
user_pref("browser.microsummary.updateGenerators", false);
user_pref("browser.cache.disk_cache_ssl", false);

user_pref("browser.microsummary.enabled", false);
user_pref("browser.microsummary.updateGenerators", false);


user_pref("browser.sessionhistory.max_total_viewers", 3);

user_pref("browser.chrome.favicons", false);
user_pref("browser.chrome.site_icons", false);
user_pref("browser.display.show_image_placeholders", true);

user_pref("accessibility.accesskeycausesactivation", false);
user_pref("accessibility.typeaheadfind.enablesound", false);
user_pref("accessibility.typeaheadfind.autostart", false);
user_pref("accessibility.typeaheadfind", false);



user_pref("browser.urlbar.maxRichResults", 20);

user_pref("browser.urlbar.matchOnlyTyped", false);