Bug 32677 - [Qt] Avoid QThread overhead on Unix platforms
Summary: [Qt] Avoid QThread overhead on Unix platforms
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: Qt
Depends on:
Blocks:
 
Reported: 2009-12-17 12:09 PST by Benjamin Poulain
Modified: 2009-12-18 03:12 PST (History)
3 users (show)

See Also:


Attachments
Use pthread instead of QThread on Unix (1.58 KB, patch)
2009-12-17 12:11 PST, Benjamin Poulain
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Poulain 2009-12-17 12:09:15 PST
QThread has a non-negligible overhead. On Linux devices, this is noticeable, because of the accesses to WTF::currentThread() for which QThread's TLS is slower to access.
Comment 1 Benjamin Poulain 2009-12-17 12:11:14 PST
Created attachment 45100 [details]
Use pthread instead of QThread on Unix

We don't use any feature of QThread, and Webkit already provide a good implementation of pthread. We can use the Webkit implementation on the relevant platform.
Comment 2 Antonio Gomes 2009-12-17 13:10:17 PST
it seems a nice change.

benjamin , have you measured the gains ?
Comment 3 Benjamin Poulain 2009-12-18 02:51:21 PST
(In reply to comment #2)
> it seems a nice change.
> 
> benjamin , have you measured the gains ?

Here is is, it is for a reduced cycler test on a N900:

With pthread:
     79,889 msec per iteration (total: 79889, iterations: 1)
     79,288 msec per iteration (total: 79288, iterations: 1)
     78,139 msec per iteration (total: 78139, iterations: 1)
     Avg: 79105

with QThread:
     80,960 msec per iteration (total: 80960, iterations: 1)
     80,543 msec per iteration (total: 80543, iterations: 1)
     81,649 msec per iteration (total: 81649, iterations: 1)
     Avg: 81050

Time spent: ~0.97%
Comment 4 Benjamin Poulain 2009-12-18 03:12:42 PST
Olivier has made a patch to remove QMap from QThread's TLS:
     79,986 msec per iteration (total: 79986, iterations: 1)
     79,925 msec per iteration (total: 70925, iterations: 1)
     78,805 msec per iteration (total: 77805, iterations: 1)

This is even better, I close this bug report.