RESOLVED FIXED 119671
FEComponentTransfer could be faster
https://bugs.webkit.org/show_bug.cgi?id=119671
Summary FEComponentTransfer could be faster
Jinwoo Jeong
Reported 2013-08-12 00:15:11 PDT
Change using SET method to direct accessing.
Attachments
Patch (1.67 KB, patch)
2013-08-12 01:01 PDT, Jinwoo Jeong
no flags
Patch (2.22 KB, patch)
2013-08-12 18:59 PDT, Jinwoo Jeong
no flags
Patch (2.28 KB, patch)
2013-08-12 23:54 PDT, Jinwoo Jeong
no flags
Patch (2.33 KB, patch)
2013-08-13 00:06 PDT, Jinwoo Jeong
no flags
Jinwoo Jeong
Comment 1 2013-08-12 01:01:02 PDT
Jinwoo Jeong
Comment 2 2013-08-12 01:14:21 PDT
In this case, the type of pixelArray->data() is unsigned char. It means we can avoid calling of SET function. And I measured the spent time of before and after patching when visit http://www.w3.org/TR/filter-effects/examples/feComponentTransfer.svg. Before adopting this patch, the function spent 190(ms). After patching, it spent only 35(ms). So this could reduce 80% of spent time. Below is about testing environment. OS: Ubuntu 12.04 64bit CPU: Intel Core i7-3770 CPU @ 3.40GHz Memory: 8,123,696 kB
Chris Dumez
Comment 3 2013-08-12 10:46:42 PDT
Comment on attachment 208515 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=208515&action=review > Source/WebCore/ChangeLog:7 > + Missing changelog. Please explain what you did and why it is better / faster. > Source/WebCore/platform/graphics/filters/FEComponentTransfer.cpp:-171 > - unsigned char c = pixelArray->item(pixelOffset + channel); Removing the char variable reduces the readability a bit IMHO.
Dean Jackson
Comment 4 2013-08-12 12:57:19 PDT
Comment on attachment 208515 [details] Patch +1 to Christophe's review.
Jinwoo Jeong
Comment 5 2013-08-12 18:59:24 PDT
Jinwoo Jeong
Comment 6 2013-08-12 19:03:36 PDT
Ok, I inserted some comment in ChangeLog. But the code that you checked is the deletion part of my changes.
Chris Dumez
Comment 7 2013-08-12 22:53:35 PDT
(In reply to comment #6) > Ok, I inserted some comment in ChangeLog. > But the code that you checked is the deletion part of my changes. Does keeping the 'char c' local variable really affect performance when building in release with -O2 or -O3? This would be surprising. What makes your code really faster is avoiding the call to set() and therefore skipping data validation (since you already know the data is fine).
Chris Dumez
Comment 8 2013-08-12 22:57:10 PDT
Comment on attachment 208582 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=208582&action=review The change looks good overall. > Source/WebCore/ChangeLog:8 > + Use direct writing to target data instead of calling SET function. SET -> Uint8ClampedArray::set() > Source/WebCore/platform/graphics/filters/FEComponentTransfer.cpp:-171 > - unsigned char c = pixelArray->item(pixelOffset + channel); could we maybe keep "unsigned char c = data[pixelOffset + channel];" just to improve readability a bit. It shouldn't affect performance but let me know if I'm wrong.
Jinwoo Jeong
Comment 9 2013-08-12 23:54:58 PDT
Chris Dumez
Comment 10 2013-08-12 23:59:12 PDT
Comment on attachment 208600 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=208600&action=review > Source/WebCore/ChangeLog:11 > + The SET function has index checking code, value checking code and value casting code. nit: Please update other uses of SET in the changelog as well > Source/WebCore/ChangeLog:14 > + Thus all works in SET function is duplicated. duplicated -> redundant > Source/WebCore/ChangeLog:15 > + So deletion of calling SET function do not reduce stability, but improve the performance. Removing the call to set() does not reduce stability but improves performance.
Jinwoo Jeong
Comment 11 2013-08-13 00:06:37 PDT
Chris Dumez
Comment 12 2013-08-13 00:18:15 PDT
Comment on attachment 208601 [details] Patch Looks good, thanks. r=me but please let Dean take a final look before landing as he was reviewing this as well.
Jinwoo Jeong
Comment 13 2013-08-13 00:49:04 PDT
CC'ing Dean, could you take a final look ? I would land this patch :)
Jinwoo Jeong
Comment 14 2013-08-13 17:42:15 PDT
Dean, if you don't have time to review this patch until tonight, I will ask another committer for landing this patch.
Dirk Schulze
Comment 15 2013-08-14 00:24:36 PDT
Comment on attachment 208601 [details] Patch (In reply to comment #14) > Dean, if you don't have time to review this patch until tonight, I will ask another committer for landing this patch. Looks good.
WebKit Commit Bot
Comment 16 2013-08-14 00:48:18 PDT
Comment on attachment 208601 [details] Patch Clearing flags on attachment: 208601 Committed r154042: <http://trac.webkit.org/changeset/154042>
WebKit Commit Bot
Comment 17 2013-08-14 00:48:21 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.