WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
136212
[TexMap] Use std::sort instead of qsort in TextureMapperLayer::sortByZOrder()
https://bugs.webkit.org/show_bug.cgi?id=136212
Summary
[TexMap] Use std::sort instead of qsort in TextureMapperLayer::sortByZOrder()
Zan Dobersek
Reported
2014-08-25 02:48:38 PDT
[TexMap] Use std::sort instead of qsort in TextureMapperLayer::sortByZOrder()
Attachments
Patch
(3.12 KB, patch)
2014-08-25 02:54 PDT
,
Zan Dobersek
no flags
Details
Formatted Diff
Diff
Patch
(3.11 KB, patch)
2015-01-06 11:05 PST
,
Zan Dobersek
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Zan Dobersek
Comment 1
2014-08-25 02:54:23 PDT
Created
attachment 237069
[details]
Patch
WebKit Commit Bot
Comment 2
2014-08-25 02:55:51 PDT
Attachment 237069
[details]
did not pass style-queue: ERROR: Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp:156: Place brace on its own line for function definitions. [whitespace/braces] [4] Total errors found: 1 in 3 files If any of these errors are false positives, please file a bug against check-webkit-style.
Sergio Villar Senin
Comment 3
2014-08-25 03:12:04 PDT
Comment on
attachment 237069
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=237069&action=review
> Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp:157 > + return a->m_centerZ < b->m_centerZ * 1000;
why "* 1000" ?
Brent Fulgham
Comment 4
2014-10-31 12:37:25 PDT
It's not clear from this bug why the change is being proposed. Do you find that std::sort is quicker than qsort, or has better memory characteristics? Could you include that in the ChangeLog to give context?
Brent Fulgham
Comment 5
2014-10-31 12:38:12 PDT
Comment on
attachment 237069
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=237069&action=review
>> Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp:157 >> + return a->m_centerZ < b->m_centerZ * 1000; > > why "* 1000" ?
That's the same as was used in the original compareGraphicsLayerZValue method.
Zan Dobersek
Comment 6
2014-11-02 02:57:55 PST
(In reply to
comment #4
)
> It's not clear from this bug why the change is being proposed. Do you find > that std::sort is quicker than qsort, or has better memory characteristics? > > Could you include that in the ChangeLog to give context?
std::sort() can be faster due to ideally inlining the comparison function. There are a couple of issues with rendering when std::sort() is used instead of qsort. I'll look into that first and then update the patch.
Zan Dobersek
Comment 7
2014-11-02 03:02:38 PST
Comment on
attachment 237069
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=237069&action=review
>>> Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp:157 >>> + return a->m_centerZ < b->m_centerZ * 1000; >> >> why "* 1000" ? > > That's the same as was used in the original compareGraphicsLayerZValue method.
I kept the same comparison that was used for qsort. But I don't know off the top of my head why 1000 is used here.
Darin Adler
Comment 8
2014-12-27 13:36:47 PST
Comment on
attachment 237069
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=237069&action=review
>>>> Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp:157 >>>> + return a->m_centerZ < b->m_centerZ * 1000; >>> >>> why "* 1000" ? >> >> That's the same as was used in the original compareGraphicsLayerZValue method. > > I kept the same comparison that was used for qsort. But I don't know off the top of my head why 1000 is used here.
That * 1000 is absolutely *not* the same as what was in the original function! The original subtracts two floats and then multiplies the difference times 1000 to convert them to an integer that the sort algorithm can use. Look carefully at where the parentheses are. This new code multiplies only b’s value by 1000. That’s not right.
Zan Dobersek
Comment 9
2015-01-05 03:26:07 PST
Comment on
attachment 237069
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=237069&action=review
>>>>> Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp:157 >>>>> + return a->m_centerZ < b->m_centerZ * 1000; >>>> >>>> why "* 1000" ? >>> >>> That's the same as was used in the original compareGraphicsLayerZValue method. >> >> I kept the same comparison that was used for qsort. But I don't know off the top of my head why 1000 is used here. > > That * 1000 is absolutely *not* the same as what was in the original function! > > The original subtracts two floats and then multiplies the difference times 1000 to convert them to an integer that the sort algorithm can use. Look carefully at where the parentheses are. > > This new code multiplies only b’s value by 1000. That’s not right.
Well, that turned out embarrassing. Thanks for spotting it.
Zan Dobersek
Comment 10
2015-01-06 11:05:59 PST
Created
attachment 244075
[details]
Patch
WebKit Commit Bot
Comment 11
2015-01-06 11:08:56 PST
Attachment 244075
[details]
did not pass style-queue: ERROR: Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp:156: Place brace on its own line for function definitions. [whitespace/braces] [4] Total errors found: 1 in 2 files If any of these errors are false positives, please file a bug against check-webkit-style.
Zan Dobersek
Comment 12
2015-01-07 05:19:19 PST
Comment on
attachment 244075
[details]
Patch Clearing flags on attachment: 244075 Committed
r178035
: <
http://trac.webkit.org/changeset/178035
>
Zan Dobersek
Comment 13
2015-01-07 05:19:28 PST
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.
Top of Page
Format For Printing
XML
Clone This Bug