Wednesday, September 24, 2008

Hacks and tricks to make Firefox Super fast

Firefox has been outperforming IE in every department for years, and version 3 is speedier than ever.

But tweak the right settings and you could make it faster still, more than doubling your speed in some situations, all for about five minutes work and for the cost of precisely nothing at all. Here's what you need to do.

1. Enable pipelining

Browsers are normally very polite, sending a request to a server then waiting for a response before continuing. Pipelining is a more aggressive technique that lets them send multiple requests before any responses are received, often reducing page download times. To enable it, type about:config in the address bar, double-click network.http.pipelining and network.http.proxy.pipelining so their values are set to true, then double-click network.http.pipelining.maxrequests and set this to 8.

Keep in mind that some servers don't support pipelining, though, and if you regularly visit a lot of these then the tweak can actually reduce performance. Set network.http.pipelining and network.http.proxy.pipelining to false again if you have any problems.

2. Render quickly

Large, complex web pages can take a while to download. Firefox doesn't want to keep you waiting, so by default will display what it's received so far every 0.12 seconds (the "content notify interval"). While this helps the browser feel snappy, frequent redraws increase the total page load time, so a longer content notify interval will improve performance.

Type about:config and press [Enter], then right-click (Apple users ctrl-click) somewhere in the window and select New > Integer. Type content.notify.interval as your preference name, click OK, enter 500000 (that's five hundred thousand, not fifty thousand) and click OK again.

Right-click again in the window and select New > Boolean. This time create a value called content.notify.ontimer and set it to True to finish the job.

3. Faster loading

If you haven't moved your mouse or touched the keyboard for 0.75 seconds (the content switch threshold) then Firefox enters a low frequency interrupt mode, which means its interface becomes less responsive but your page loads more quickly. Reducing the content switch threshold can improve performance, then, and it only takes a moment.

Type about:config and press [Enter], right-click in the window and select New > Integer. Type content.switch.threshold, click OK, enter 250000 (a quarter of a second) and click OK to finish.

4. No interruptions

You can take the last step even further by telling Firefox to ignore user interface events altogether until the current page has been downloaded. This is a little drastic as Firefox could remain unresponsive for quite some time, but try this and see how it works for you.

Type about:config, press [Enter], right-click in the window and select New > Boolean. Type content.interrupt.parsing, click OK, set the value to False and click OK.

5. Block Flash

Intrusive Flash animations are everywhere, popping up over the content you actually want to read and slowing down your browsing. Fortunately there's a very easy solution. Install the Flashblock extension (flashblock.mozdev.org) and it'll block all Flash applets from loading, so web pages will display much more quickly. And if you discover some Flash content that isn't entirely useless, just click its placeholder to download and view the applet as normal.

6. Increase the cache size

As you browse the web so Firefox stores site images and scripts in a local memory cache, where they can be speedily retrieved if you revisit the same page. If you have plenty of RAM (2 GB of more), leave Firefox running all the time and regularly return to pages then you can improve performance by increasing this cache size. Type about:config and press [Enter], then right-click anywhere in the window and select New > Integer. Type browser.cache.memory.capacity, click OK, enter 65536 and click OK, then restart your browser to get the new, larger cache.

7. Enable TraceMonkey

TraceMonkey is a new Firefox feature that converts slow Javascript into super-speedy x86 code, and so lets it run some functions anything up to 20 times faster than the current version. It's still buggy so isn't available in the regular Firefox download yet, but if you're willing to risk the odd crash or two then there's an easy way to try it out.

Install the latest nightly build (ftp://ftp.mozilla.org/pub/firefox/nightly/latest-trunk/), launch it, type about:config in the address bar and press Enter. Type JIT in the filter box, then double-click javascript.options.jit.chrome and javascript.options.jit.content to change their values to true, and that's it - you're running the fastest Firefox Javascript engine ever.

8. Compress data

If you've a slow internet connection then it may feel like you'll never get Firefox to perform properly, but that's not necessarily true. Install toonel.net (toonel.net) and this clever Java applet will re-route your web traffic through its own server, compressing it at the same time, so there's much less to download. And it can even compress JPEGs by allowing you to reduce their quality. This all helps to cut your data transfer, useful if you're on a limited 1 GB-per-month account, and can at best double your browsing performance.

Sunday, September 21, 2008

IE6, IE7 and IE8 under Mac or Linux (cont.)

The good news is that Microsoft provides free VirtualPC disk images for each of their browsers:

http://www.microsoft.com/downloads/details.aspx?FamilyId=21EABB90-958F-4B…

The bad news is that they wont run on Mac and VirtualPC wont run inside Parallels or VMWare Fusion — but I’ve found a solution! We can convert the disk images to work for VMWare Fusion or VirtualBox.

Setup

First go and download the versions of IE you want to use:


http://www.microsoft.com/downloads/details.aspx?FamilyId=21EABB90-958F-4B…

To do the conversion you’ll need a copy of the Qemu command line tool. I couldn’t get it to work on Mac, so you’ll probably need to use it on a Linux or Windows machine. (you can do this through Parallels or VMWare Fusion too) Download, extract and install Qemu tool on your computer.

Linux

WILL NOT work on windows because it was not compiled to support files over 2GB.
http://fabrice.bellard.free.fr/qemu/

Windows

Download “Qemu-0.9.1-windows.zip” from:
http://lassauge.free.fr/qemu/

VMWare Fusion

This is the easiest way to go and has superior support for shared network and clipboard between Mac and PC, except it means you’ll need to buy a copy of VMWare Fusion. I wrote these instructions using the trial version, someday I’ll buy my own full version.

The process will probably take less than an hour and require about 2Gb of space. These instructions are tailored towards using Windows for the file conversion with qemu. If you’re using Linux you’re probably smart enough to adapt these instructions to your system. Several people in the comments have mentioned being able to use Q on the Mac to do the file conversion.

  1. Open a command prompt: Start > Run and type “cmd”
  2. Use “cd” to go to the directory you download and extracted Qemu.
  3. Run:
    qemu-img.exe convert -f vpc "XP SP2 with IE7.vhd” -O vmdk XPIE7.vmdk
    • “XP SP2 with IE7.vhd” is the path to the IE VPC file you downloaded
    • “XPIE7.vmdk” is the new file that VMWare Fusion will use.
  4. Wait…(will probably take 15 - 30 minutes)
  5. Move the new “.vmdk” file to your mac.
  6. Open VMWare Fusion and click File > New
  7. Go through the wizard and when you get to the “Virtual Hard Disk” page, expand “Advanced disk options”, check “Use an existing virtual disk” and use the dropdown to find the new “.vmdk” file.
  8. Finish the wizard and start it! (If prompted to upgrade the virtual harddrive, click “Yes”)
  9. Ignore any driver dialogs that ask you to insert a Windows CD. The VMWare Tools should install these drivers for you (see next step).
  10. Install the VMWare tools (Virtual Machine > Install VMWare Tools) as soon as Windows boots up. If installing the tools gives you a weird error, read the next section.
  11. You’re done!

Installing the VMWare Tools

If the VMWare Tools wont install automatically follow these simple steps to install it manually:

  1. With VMWare Fusion running click Virtual Machine > Install VMWare Tools
  2. Open your “My Computer” to see which drive letter the CDRom with the VMWare Tools has mounted to.
  3. Open a command prompt: Start > Run and type “cmd”
  4. Type the following and press enter (change “D” to the drive letter from step 2):
    • msiexec -i "D:\VMware Tools.msi"
  5. The installation wizard should open and walk you through the rest of the install.

VirtualBox

The great thing with VirtualBox is that it’s free and available for most OSes! The process will take a little longer and will temporarily require about 20Gb - 30Gb of disk space. In the end your IE virtual disk will only be about 2Gb.

You might be tempted to do the VMWare Fusion conversion, outlined above, and use the “.vmdk” file in VirtualBox. It’s true that VirtualBox supports “.vmdk”, but everytime I tried it I ran into massive problems.

These instructions are tailored towards using Windows for the file conversion with qemu. If you’re using Linux you’re probably smart enough to adapt these instructions to your system. Several people in the comments have mentioned being able to use Q on the Mac to do the file conversion.

  1. Open a command prompt: Start > Run and type “cmd”
  2. Use “cd” to go to the directory you download and extracted Qemu.
  3. Run: qemu-img.exe convert -f vpc "XP SP2 with IE7.vhd” -O raw XPIE7.bin
    • “XP SP2 with IE7.vhd” is the path to the IE VPC file you just downloaded
    • “XPIE7.bin” is the new file.
  4. Wait…(will take about an hour)
  5. Move the new “.bin” file to your mac. (or try the next 2 steps on the same machine)
  6. Install VirtualBox
  7. Convert and compress the “.bin” file. (This can also be done on Windows or Linux if you have VirtualBox on that machine)
    1. Open a terminal or command prompt.
    2. Go to the directory where your “.bin” file is.
    3. VBoxManage convertdd XPIE7.bin XPIE7.vdi (FYI: on Windows, VBoxManage is in “C:\Program Files\innotek VirtualBox\”)
    4. VBoxManage modifyvdi XPIE7.vdi compact
  8. Open VirtualBox
  9. Click New
  10. Go through the wizard
    • Give it at least 350MB of “Base Memory”
    • Use the new “.vdi” file as the “Boot Hard Disk”.
  11. Finish wizard and start it!
  12. Ignore any driver dialogs that ask you to insert a Windows CD. The VirtualBox tools should install these drivers for you (see next step).
  13. Be sure to install the VirtualBox tools as soon as Windows boots up. (Click: Device > Install Guest Additions)

How to have IE on Linux

Most of you guys already know how to do this trick, but for those of you who don't check below.

IEs 4 Linux needs two packages: cabextract and Wine. You can install them using your Linux package manager (synaptic, apt-get, yum, emerge etc) or go to their sites.

After that, download IEs 4 Linux. Extract it. Run 'ies4linux'. Follow the instructions.

In a terminal, you can do:

wget http://www.tatanka.com.br/ies4linux/downloads/ies4linux-latest.tar.gz
tar zxvf ies4linux-latest.tar.gz
cd ies4linux-*
./ies4linux

Note: This allows you to install IE6 and a (as beta) IE7, for the moment IE8 is not supported.

Saturday, September 20, 2008

IE 7 and IE 8 on the same machine?

Running both Internet explorer 7 and Internet explorer 8 on the same machine is not tricky stuff like with previous versions of IE.


IE7 Emulation Mode


This point means that developers can continue to do real world client site testing in IE7 at the flick of a switch. Switch of IE7 emulation and you can still continue testing and preparing for the release of IE8. This is a very nice feature and makes the life of developers much easier.
Previously, developers required a virtual machine to run IE6 and IE7 so you had to log in to the virtual machine to use and test in IE6. You still need to restart the browser each time you want to switch between IE8 and IE7 emulation, mode but that’s no real hardship.


When you experience a problem, just a click on a button and restart of the browser takes you back to IE7. Great feature to support soon to be legacy interfaces.



To switch to Internet Explorer 7 Emulation mode, click on the “7″ icon the browser or click “Tools - IE7 Emulation” and click OK on the message box which indicates you need to restart the browser. Once you restart the browser, you are in IE7.
When you are happy to switch back to IE8 default, simply click the same “7″ icon and click OK in the message box and restart the browser. Yeah..back in Internet Explorer 8 default mode.

Thursday, September 18, 2008

Mozilla to remove Firefox EULA

Ubuntu users who couldn’t stand the idea of a EULA (End User License Agreement) for the popular Firefox Web browser are going to get their way. The Mozilla Foundation’s chairperson, Mitchell Baker, has agreed to entirely remove the Firefox EULA.

In her blog, Baker wrote, “We’ve come to understand that anything EULA-like is disturbing, even if the content is FLOSS (Free/Libre/Open Source Software) based. So we’re eliminating that. We still feel that something about the web services integrated into the browser is needed; these services can be turned off and not interrupt the flow of using the browser. We also want to tell people about the FLOSS license — as a notice, not as as EULA or use restriction. Again, this won’t block the flow or provide the unwelcoming feeling that one comment to my previous post described so eloquently.”

What this new way of telling people about Firefox’s license, the MPL (Mozilla Public License), will be hasn’t been determined yet. “We’re still working on this. There’s been a bunch of helpful feedback. We appreciate this. We think we’ve integrated the feedback into something that’s a good solution; different from out last version in both its essence and its presentation and content.” She added that this new “solution” should be made public sometime today, September 17.

This EULA fight began when Mozilla issued Firefox 3.02 with a new EULA that rapidly drew fire from Ubuntu users. Mark Shuttleworth, founder of Ubuntu, urged users to calm down while Canonical, the company behind Ubuntu, and Mozilla worked on the problem.

Baker quickly tried to get on top of the problem by issuing a proposed revision to the EULA. When this version also drew far more complaints than praise, Baker and the rest of the Mozilla leadership decided to abandon entirely a EULA approach and take a different approach.

While it still isn’t entirely clear what this will be, simply dropping any sign of a EULA will likely go a long way to calming upset Ubuntu Linux users.

FoxTab - show all open tabs in one window

Beacuse Chrome has this already something similar built-in some guys though of this and decided to build FoxTab.
FoxTab provides a new fascinating and elegant method for finding and selecting a tab in the browser. FoxTab is designed to be suitable for many types of users, those with only few tabs opened and those out there (like me) who usually have tons of opened tabs to select from.
The idea behind FoxTab is to provide new visual methods for quick tab switching.
  
   

Monday, September 15, 2008

Speed-up Web Aplications: "Developers should skip Google's Chrome, and jump straight to WebKit"

Inside every browser is the core of the ideal client-side application environment, incorporating everything that I'd estimate half of commercial applications need. There's the best dynamic, object-oriented, loosely typed programming language, bar none (JavaScript), transparently bound to an idiot simple yet extensible presentation layer (DHTML, CSS, XML, DOM, SVG...). Browser-based apps don't require specialized development tools, or any tools at all. All that keeps your browser from being the perfect client app environment is speed, stability, strict adherence to standards, and offline capabilities. That is not too much to ask; it's all within reach, right now. It's a matter of adjusting our priorities and perspective.

[ Beefed up for application duty, Google Chrome, and Internet Explorer 8 reach new heights in browser resource consumption. See the Test Center review. Also, check out InfoWorld's Special Report for all the news, reviews, and commentary on Google's open source Chrome browser. ]

Forget about trying to make projects fit browsers and focus on higher objectives. We want a cross-platform, cross-architecture development platform that can take an app from behavior-accurate prototype to full functionality in stages and with minimal skill. We want applications that can be QA'd in site at the operational level, patched remotely, and updated automatically. We need to adapt to specifications that are altered while the project is underway. Code has to be ultimately reusable, and we need the capability to easily reach out to legacy back-ends. We never want to hear our support staff tell a user "we can't reproduce that problem." If we have to let a developer go, we want to know that he can't lock up his code on the way out, and that anyone of comparable skill can take over and be up to speed in a couple of days.

Now, knowing what we want, we can think about how to achieve all of this, and now we can come back to the browser. If we could achieve the ideal, a browser's got everything a development project would love to have but can't dream of putting in the schedule. The trouble is that browsers are designed for surfing, not as application platforms. Think about it. If you were cranking up a new client development project, would you issue a statement of objectives that it must look like a Web site, take twenty seconds to paint a window, offer no feedback when you click a button, skip reporting the progress of transactions, refuse to run unless you're connected to a network, and force users to re-enter form data if there's a hiccup in delivery? It's telling that the first thing an erstwhile Web application does is free itself from the trappings of a browser: It removes the navigation bar, the menu (when it can -- OS X doesn't allow it) and the status bar, redirects the right mouse button away from the default context menu and makes it impossible to resize the window. If you use the browser, the standard is to work like hell to hide it, and to solve performance problems by embedding Java or ActiveX objects.

It reads like a no-win deal until you realize that you don't need a fat, clunky browser. You don't need to host a browser in an application window. Just take the framework shared by multiple commercial browsers and bake it right into your project. That's WebKit. At a total cost of nothing and with free lifetime updates, it's as sweet a deal as you'll find, and unlike many open source projects that you'd love to use but which vary in the quality of support, documentation, and maintenance, WebKit is driven by companies like Apple, Nokia, and most recently, Google, that rely on it for commerce. The Iris Browser from Touch Mobile, which uses WebKit, is the first worthwhile free alternative to Internet Explorer on Windows Mobile devices, and it's the best first pass I've seen yet on borrowing iPhone's touch interface. Even though it's most frequently seen in browsers, WebKit is a lot more than a browser in a can. It advances the state of the art faster and farther than is required for a browser.

The best example of this is WebKit's new tokenizing JavaScript engine, SquirrelFish. The latency associated with the retrieval of most Web pages makes the speed of JavaScript execution a minor issue, but JavaScript's poor performance takes it out of contention as an application language. It's not a hard problem to solve; there is no shortage of engineers skilled at making interpreted languages run faster. There just wasn't the will to do it for JavaScript until some people realized that JavaScript is a serious language in need of a serious implementation. SquirrelFish takes two vital first steps toward elevating WebKit's JavaScript to first-class status: Mapping bulky JavaScript to more efficient, partially digested ("compiled") bytecode, and using a register model instead of a stack model.

The stack model stuffs all of the data passed between functions into a single pool of memory. It is the duty of every function that uses the stack to leave it precisely as it found it lest other function calls get the wrong data passed to them. Functions have to pull data from the stack to make local copies for their use, and to return data to the calling function they must shove the results back onto the stack. Stack-based interpreters are easy to write, but hard to optimize. Register-based interpreters use a direct reference (in loose terms, pointers) to data needed to call a function. Just this one change from a stack-based interpreter to a register-based virtual machine delivers performance gains of 1.5x to more than 3x depending on the operation, and that's how WebKit without SquirrelFish compares to WebKit with SquirrelFish. It borders on unfair to compare WebKit (Safari 3.1) performance to Firefox, but it does highlight the difference between a JavaScript for applications and a JavaScript for surfing.

It's not that no one thought of making a bytecode JavaScript, any more than it's a new idea to put smoothly scaled and animated vector graphics in a browser (SVG). No one cared to do it because the day-to-day surfing experience wouldn't be enhanced by it. WebKit has higher aspirations than surfing, and there is more advanced science in WebKit than its JavaScript interpreter. The whole framework is shifting into ever higher gears in performance, standards compliance, completeness, and stability. WebKit is a framework that brings the benefits of a browser to all applications, across platforms, even ones that don't use the network. It doesn't hurt that WebKit is free and open source, that a Safari-workalike browser is included in the distribution, and that it uses middleware (HTTP) and object representation standards (XML) that bind it to all back-ends. Get WebKit and be proud to use browser technology in serious applications.