Bas
2009-11-25

Firefox and Direct2D: Performance Analysis

So, it seems my little demo of a pre-alpha firefox build with Direct2D support has generated quite some attention! This is good, in many ways. Already users trying out the builds have helped us fix many bugs in it. So I'm already raking in some of the benefits. It has also, understandably, led to a lot of people running their own tests, some more useful than others, some perhaps wrong, or inaccurate. In any case, first of all I wanted to discuss a little on how to analyze D2D performance with a simple firefox build.

Use the same build
Don't compare a random nightly to this build in performance. The nightly builds contain updates, no two nightly builds will be the same, and therefor perform the same. I don't continuously keep my D2D builds up with the latest repository head. Additionally the build flags used may very well not be the same, for example some builds(like the nightlies) may be built with something called Profile Guided Optimization, which means the compiler analyzes hotspots, and optimizes them. This significantly improves their JavaScript performance. My test build is not build with PGO, although I might release a build using PGO as it gets more stable. This is probably causing some of the differences some people testing have been seeing. Please keep in mind that because this is not a final, complete build, it should probably not be compared too enthusiastically to other browsers either.

If you want to properly compare performance, use my build, and switch on the forcegdi pref. Go to 'about:config' and look for the font.engine.forcegdi pref, and set that to true. After that, you will have a build using GDI only.

Obviously I should have mentioned this in my previous post, so people would not have wasted their time on inaccurate performance analysis. I apologize for that, it is partially because I had not expected so much publicity.

Focus on what (should be) different
When you do run tests, it is of course always valuable to get measurements on the overall performance of the browser. If there's some other part of the browser than rendering showing performance decreases, I'm doing something wrong and please do let me know! There is however, a lot of more involved with displaying and parsing a webpage than just the rendering. If you want to get a really good idea on what it does to your rendering speed, you'll want to measure solely the time it takes to do the actual drawing. We have a non-cross-browser tool in Mozilla in my build that will allow you to do this. You can add a 'bookmarklet' that runs this test, just add a bookmark, and make it point to 'javascript:var r = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils).redraw(500); alert(r + " ms"); where the number inside 'redraw' is the number of rendering runs you want to time. It will then pop up an alert box which will tell you the time in milliseconds it took to execute the redraws. Keep in mind this still only analyzes static rendering performance.

Know what you're measuring, and how you're doing it
If you are using an independent measurement benchmark. Be sure you understand well exactly what it measures, and how it does it. This is a very important step. Something spewing out a number and then listing 'higher is better' for a certain part of functionality is great, but it only becomes useful information when you know how the measurement is executed, what it's margin of error is, and what the overhead is it adds to the whatever it is testing. For a lot of all-round browser benchmarks, rendering is only a small part of what's tested. And the total test result differences between D2D enabled and disabled, may not reflect the actual difference in user experience.

Considerations on static page-loading measurements
Since obviously just a rendering improvement if it doesn't actually function better for the end user is practically useless, keep in mind that when you're timing how long it takes to load a page, you're timing all the aforementioned overhead. When interacting with the page without switching to another page, a lot of this overhead does not occur, and a large part of time might be spent in actual rendering. This means that during dynamic interaction (like scrolling), improvements may be more noticeable, although harder to measure.

And finally, thanks!
It's been great to see how many people are trying this, and as I mentioned earlier in this post, it has already greatly assisted us. It's also great that people are working on their own tests of performance and such things, it is always a good thing to have independent performance tests ran. And this too, will help us improve on the build in areas where our own testing may have been lacking. So, thanks, to everyone who is directly or indirectly helping to hopefully provide a great new feature!

27 comments

# Gabriela   on 2009-11-25 at 20:31

Hi Bas,

I’m actually on Minefield (Firefox 3.7apre nightly) and I’d love to try your build.
Could you please tell me where can I find your build’s link and the preferences I should change in about:config?
Should this be risky regarding my daily profile, bookmarks, etc? Should I try it on a new profile?
I’ll appreciate your answer as soon as possible!

Many thanks,
Best regards,
Gabriela

# [Member]   on 2009-11-25 at 20:58

@Gabriela: You can find the special build in my previous blogpost from sunday :-)

# Steven on 2009-11-25 at 22:09

@Bas, thnx for the GDI switch. I hope you didn’t take my benchmark posting as a critisism though, I am fully aware that that this is a development snapshot and not optimized at all.

My point was that despite it being slower in a few of the categories, to me it feels ALOT faster than all the other browsers, particularly while scrolling.

And frankly, don’t bother optimizing other stuff in your builds just so people will shut up, I’m sure we’d all you rather spend your valuable time nailing this D2D thing. I’m sure I would.

I’ll try to do some comparisons with the GDI switch and bookmarklet tomorrow or so, but it almost doesn’t matter. As I said the scrolling speed alone is worth it.

Cheers

# alanjstr on 2009-11-25 at 22:47

I’m really excited about this. I also wish Moz could provide a build customized for my CPU. How are you planning on supporting XP and Win7 with a single build? Will the installer set the pref?

# [Member]   on 2009-11-25 at 22:50

@Steven: Thanks! Building it completely optimized to production spec allows people to do the comparison vs. other browsers though, which we know they will try to ;) But yeah. For now I’m busy processing review comments so we can hopefully get this into the tree in the future!

@alanjstr: This build should already be fine under XP. It will look for the function DLL entries to create DirectWrite/D2D. If it can’t find them it will just fallback to GDI. This is done at startup and should require nothing to be done by the user or the installer.

# Gabriela   on 2009-11-26 at 00:58

Hi Bas,
I’ve tried your build and the speed is absolutely amazing!!!
I won’t go back to my usual Minefield because I’ll much rather use your build but how do I avoid updating nighties?
Maybe setting “Ask me what to do” in the Advanced update options?
Will you be updating this build soon?

# [Member]   on 2009-11-26 at 01:07

@Gabriela: This build will never upgrade. It’s completely experimental. I am regularly updating new builds as I fix bugs (multiple times a day), but I only occasionally update to the latest repository head.

# Gabriela   on 2009-11-26 at 02:20

Hi Bas,
Many thanks for your quick reply!
Where can I find the latest build then? At the same blog post from Sunday where I got this one or……..?

# [Member]   on 2009-11-26 at 02:26

@Gabriela: Yes, I upload it to the same location.

# Rich on 2009-11-26 at 09:44

Good work, seems really snappy. I noticed it doesn’t render properly in aero peek when you hover over the small window. Take it that’s a known issue at the moment?

# Milos on 2009-11-26 at 11:50

Thank you very much for doing this work. Text looks amazing now.

# [Member]   on 2009-11-26 at 13:29

@Rich: It is, Aero Peek at the moment does not display text. For now, we have no idea what causes this.

# Jelmer   on 2009-11-26 at 15:26

Bas, like I posted in my Tweakers.net reaction, the previous build you put online didn’t do anything on my machine, yet I run Windows Vista and have a DX10 card. Since I do a lot with SVG, I’d love to try out your build.

Perhaps contact me directly? jelmerbs_a_t_ziggo.nl

# Gabriela   on 2009-11-26 at 20:10

Bas, many thanks for your answer!

# scorpeeon on 2009-11-27 at 14:31

i tried it, and seems to be a really great stuff :)
it’s really notable faster on many sites.
i also noticed the different text rendering (with “regular” rendering it seems a bit smoother), but it’s not a big problem imho, it looks still nice.
also noticed the aero peek bug, it’s not a big deal though.

i also noticed a problem that others didn’t mention much: there are some issues with some mouse actions. for example: right click has sometimes some serious delay (occasionally it takes seconds for that window to appear properly), sometimes if i move my mouse over a link or bookmark, it also takes some time for the expected action to happen.
i notice the same delay while marking text with the mouse, especially for the last character i select, sometimes it shows it’s marking happen really slowly. i think the marking itself happens so fast it should (because i can copy the text i selected which shows not marked yet, only with some delay), it’s just not showing it fast enough. i hope you get what i mean.

so it doesn’t seem to be perfect yet, but keep up the good work, it’s going to be a great thing :)

# anonymous on 2009-11-27 at 14:45

Please then use an OpenGL backend on XP, if not DirectX. Don’t leave out the world’s 70% users running Firefox without hardware acceleration.

# kalkzone on 2009-11-27 at 16:47

I just got the information of the 2d accelleration.

WHAT I Hope for is:

Don’t forget the energy consumption. on using this or that API.

I don’t know much about it myself; but i guess the graphics cards might switch into different modes.

If for example the newest Radeon card (idle ~ 30 Watts)
would step into a mode consuming the current as if it was running a most powerfull 3d shooter (lets say 250 watts)

i would describe it ERROGENEOUS to accelerate websites or with movies and media integrated.

I hope you can spread this thinking into the developers minds.

Beside the development, congratulation to all, that can do this on firefox,
the measurement of power consumption should not be missed.

regards
kalkzone


# Napalmdest54 on 2009-11-29 at 03:07

When scroll on most sites horizontal lines will go across the width of the window. Also text after scrolling seems to be messed up.

Using Windows 7 64bit, 4870 (DX10) 9.11 drivers.

# Markus on 2009-11-29 at 13:00

@ kalkzone

Actually modern gpus have a very wide scope of performance settings, and rendering 2d for web applications does not go very far beyond idle (if at all). Even the most advanced 3d games don’t average beyond 80% at most. So power consumption should not increase noticeably.

Chances are, it is probably more energy efficient rendering with a gpu, than using cpu time.

Bugwise:

I have also been experiencing lagging when marking text with the mouse, also double clicking to mark the adress bar does not seem to work completely. Seems to be the same as scorpeeon mentioned.

# Stebs on 2009-12-01 at 13:57

Got a slightly OT Question about Direct2D (after a fierce discussion in another forum about it):

Is there any performance or feature difference between DX 10.0 and DX 10.1 Hardware for your Direct2D accelerated Firefox?
-Given one uses Windows7, latest DX API and WDDM 1.1 Drivers for both Cards.
Some say that only 10.1 Hardware (ATI Cards and only some recent Nividia Cards) does provide full performance, but I don’t see it that way (10.0 Hardware with WDDM 1.1 Drivers are “enough” for full performance).
Thanks for any clarification!

# [Member]   on 2009-12-01 at 17:48

@Stebs: Well, I’m no expert on the subject either, but in theory, 10.1 cards would support some higher shader model versions. It could be that D2D will be able to use that to optimize certain operations a bit more. But generally I’d say there shouldn’t be a significant performance impact.

# Isaac on 2009-12-18 at 16:21

By the way - if I go into fullscreen mode in your version of Firefox the artefacts do not appear when scrolling up and down. But outside of fullscreen mode they do appear.

Might be helpful in tracking down why this happens :-)

# Vic   on 2009-12-21 at 04:00

Awesome! It works decently on a ati x1600 mobility video card. Obviously it doesn’t rull at full accel (some pic/text pages lag) but for 80% of the web sites i view it works pretty well. I have the blurry text problem though. It would be interesting to see how a PGO build handles. Perhaps a nicely tuned PGO build could compensate for older cards.

# struggle on 2009-12-22 at 19:18

Please, Please also provide opengl acceleration for all the firefox linux users out there !
isn’t there a experimental cairo-gl backend (not the glitz one) in recent cairo versions ?

# Jimmy   on 2010-01-03 at 13:06

Also working great here on d×9 x1600 on vista sp2 with platform update. Google maps and especially the photo resizing demo are noticeably faster and smoother (10% cpu usage compared to 50 - 60% with gdi enabled). I would definitely say that its worth it even for lowly wddm 1.0 cards, rendering wasn’t noticeably faster, but scrolling etc. is much, much smoother.

# carol on 2010-05-19 at 03:15

http://beta.html5test.com/
try this one for size!

# carol on 2010-05-21 at 18:02

Firefox 3.7a5-pre ,received an update on the 21 of may, Windows 7 (64),amd x2 550,ati 5770 . This build has Direct2D acceleration enabled,and directwrite enabled.

java bitmap 600:buffer:strategy:647.63 fps
:buffer:image :43.5 fps

i know you might be busy but is it possible to check if this could affect mozilla .if not maybe ask website builder and all to change
from image to strategy or whatever its called in hid code.20 fps i dont bother.but thisits 600 fps more hell everything on the web can be designed with this in mind.ty
keep up the good work!


Form is loading...

June 2019
Mon Tue Wed Thu Fri Sat Sun
 << <   > >>
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Certain events have made me realise it's probably a good idea to have a 'blog' to share ideas and get feedback...

Search

  XML Feeds

powered by b2evolution CMS