Bug 33876 - [Qt] Shortcut for Font::floatWidthForComplexText
Summary: [Qt] Shortcut for Font::floatWidthForComplexText
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Holger Freyther
URL:
Keywords: Qt
Depends on:
Blocks: 34208
  Show dependency treegraph
 
Reported: 2010-01-19 16:52 PST by Holger Freyther
Modified: 2010-03-07 23:19 PST (History)
4 users (show)

See Also:


Attachments
First patch (2.39 KB, patch)
2010-01-28 04:29 PST, Holger Freyther
ariya.hidayat: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Holger Freyther 2010-01-19 16:52:52 PST
For text which only consists of one charachter we can avoid using harfbuzz and try QFontMetrics::width instead. In the case of loading google.com/news (english version) 23% of all calls to the floatWidthForComplexText is from a space. It is also true for other sites with less links.

I'm currently doing a reduction and looking into the possible performance gain.
Comment 1 Holger Freyther 2010-01-28 04:29:01 PST
Created attachment 47605 [details]
First patch

Only ' ', '\t' has the benefit of being fast with QFontMetrics::width. Any other charachter might or might not have different rounding and about the same speed as harfbuzz. This is a significant improvement on the pageloading test.
Comment 2 Benjamin Poulain 2010-01-29 02:29:07 PST
Here are the results of the painting benchmark on a regular N900:

Before the patch:
	benchmark: http://en.wikipedia.org/wiki/Main_Page
		mean:       30 msecs +/- 1 msecs, +/- 3.333333 %
		avg:        30 msecs
			31, 30, 30, 30, 31, 30, 30, 32, 30, 32, 
	benchmark: http://en.wikipedia.org/wiki/Nokia
		mean:      244 msecs +/- 1 msecs, +/- 0.409836 %
		avg:       243 msecs
			244, 243, 242, 245, 244, 246, 242, 242, 244, 244, 
	benchmark: http://buzz.blogger.com/
		mean:      182 msecs +/- 1 msecs, +/- 0.549451 %
		avg:       181 msecs
			181, 182, 181, 181, 179, 183, 181, 182, 182, 182, 
	benchmark: http://googleblog.blogspot.com/
		mean:       82 msecs +/- 0 msecs, +/- 0.000000 %
		avg:        81 msecs
			81, 81, 81, 82, 82, 81, 82, 80, 82, 82, 
	benchmark: http://news.163.com/
		mean:      299 msecs +/- 1 msecs, +/- 0.334448 %
		avg:       299 msecs
			299, 301, 300, 299, 299, 298, 300, 301, 299, 299, 
	benchmark: http://www.imdb.com/title/tt0468569/
		mean:       49 msecs +/- 0 msecs, +/- 0.000000 %
		avg:        49 msecs
			49, 48, 50, 50, 48, 49, 50, 50, 49, 49, 
	benchmark: http://www.flickr.com/photos/rocio-ponce/3209550712/
		mean:       54 msecs +/- 0 msecs, +/- 0.000000 %
		avg:        53 msecs
			54, 54, 53, 52, 54, 53, 55, 54, 54, 55, 
	benchmark: http://www.amazon.com/Kindle-Wireless-Reading-Display-Generation/dp/B0015TG12Q/
		mean:      296 msecs +/- 2 msecs, +/- 0.675676 %
		avg:       294 msecs
			296, 294, 292, 296, 299, 292, 292, 294, 297, 296, 

With the page:
	benchmark: http://en.wikipedia.org/wiki/Main_Page
		mean:       30 msecs +/- 0 msecs, +/- 0.000000 %
		avg:        30 msecs
			31, 30, 31, 30, 31, 30, 30, 30, 31, 30, 
	benchmark: http://en.wikipedia.org/wiki/Nokia
		mean:      242 msecs +/- 3 msecs, +/- 1.239669 %
		avg:       242 msecs
			241, 241, 242, 251, 241, 243, 242, 242, 242, 240, 
	benchmark: http://buzz.blogger.com/
		mean:      181 msecs +/- 0 msecs, +/- 0.000000 %
		avg:       180 msecs
			181, 180, 181, 180, 181, 179, 181, 181, 181, 182, 
	benchmark: http://googleblog.blogspot.com/
		mean:       81 msecs +/- 0 msecs, +/- 0.000000 %
		avg:        81 msecs
			81, 81, 81, 81, 80, 81, 83, 80, 81, 81, 
	benchmark: http://news.163.com/
		mean:      297 msecs +/- 0 msecs, +/- 0.000000 %
		avg:       296 msecs
			297, 297, 298, 297, 297, 296, 297, 297, 296, 297, 
	benchmark: http://www.imdb.com/title/tt0468569/
		mean:       49 msecs +/- 0 msecs, +/- 0.000000 %
		avg:        48 msecs
			49, 49, 49, 49, 49, 48, 48, 49, 49, 49, 
	benchmark: http://www.flickr.com/photos/rocio-ponce/3209550712/
		mean:       53 msecs +/- 0 msecs, +/- 0.000000 %
		avg:        53 msecs
			53, 53, 52, 54, 53, 53, 54, 53, 52, 53, 
	benchmark: http://www.amazon.com/Kindle-Wireless-Reading-Display-Generation/dp/B0015TG12Q/
		mean:      292 msecs +/- 1 msecs, +/- 0.342466 %
		avg:       292 msecs
			295, 291, 292, 291, 294, 292, 292, 294, 294, 290, 

Good job Holger.
Comment 3 Holger Freyther 2010-01-29 02:37:34 PST
Oh, even a small win on painting. You would see a bigger win on the tst_cycler benchmark as the WebCore::Font method is called more often there.
Comment 4 Ariya Hidayat 2010-01-31 15:52:31 PST
Comment on attachment 47605 [details]
First patch

LGTM.
Comment 5 Eric Seidel (no email) 2010-02-01 16:12:36 PST
Attachment 47605 [details] was posted by a committer and has review+, assigning to Holger Freyther for commit.
Comment 6 Laszlo Gombos 2010-02-22 21:44:24 PST
Ping; Holger can you mark this cq+, if you think it is ready ? Thanks.
Comment 7 Holger Freyther 2010-03-02 02:19:54 PST
Landed in r55406. We will have to see how it behaves on all the fonts out there..