WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
156593
AffectsNextSibling style relation marking is inefficient
https://bugs.webkit.org/show_bug.cgi?id=156593
Summary
AffectsNextSibling style relation marking is inefficient
Antti Koivisto
Reported
2016-04-14 13:42:40 PDT
We add a StyleRelation entry for each sibling to mark. With long sibling lists this can be inefficient in terms of both memory and speed. Instead make a single entry that includes the sibling count to mark.
Attachments
patch
(9.02 KB, patch)
2016-04-14 13:52 PDT
,
Antti Koivisto
no flags
Details
Formatted Diff
Diff
patch
(10.09 KB, patch)
2016-04-14 14:12 PDT
,
Antti Koivisto
benjamin
: review+
Details
Formatted Diff
Diff
patch
(9.84 KB, patch)
2016-04-15 00:07 PDT
,
Antti Koivisto
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Antti Koivisto
Comment 1
2016-04-14 13:52:47 PDT
Created
attachment 276420
[details]
patch
Antti Koivisto
Comment 2
2016-04-14 14:12:25 PDT
Created
attachment 276426
[details]
patch
Radar WebKit Bug Importer
Comment 3
2016-04-14 14:38:10 PDT
<
rdar://problem/25735554
>
Benjamin Poulain
Comment 4
2016-04-14 14:46:45 PDT
Comment on
attachment 276426
[details]
patch View in context:
https://bugs.webkit.org/attachment.cgi?id=276426&action=review
> Source/WebCore/css/SelectorChecker.cpp:94 > + if (last.type == Style::Relation::AffectsNextSibling && last.element->previousElementSibling() == &element) {
It would likely be better to do: element ->nextElementSibling() == last.element to avoid touching the memory of last.element again.
> Source/WebCore/cssjit/SelectorCompiler.cpp:2214 > + LocalRegister lastRelation(m_registerAllocator); > + m_assembler.load32(sizeAddress, lastRelation);
It would be better to have this load above the mergeFailure above. Currently the CPU will have to do two loads: 1) m_assembler.branchTest32(Assembler::Zero, sizeAddress) 2) m_assembler.load32(sizeAddress, lastRelation); If you write: LocalRegister size(m_registerAllocator); m_assembler.load32(sizeAddress, size); mergeFailure.append(m_assembler.branchTest32(Assembler::Zero, size)); m_assembler.sub32(Assembler::TrustedImm32(1), size); ... Then you only need one load.
> Source/WebCore/cssjit/SelectorCompiler.cpp:2237 > + m_assembler.load32(valueAddress, value); > + m_assembler.add32(Assembler::TrustedImm32(1), value); > + m_assembler.store32(value, valueAddress);
If you want you can do m_assembler.add32(Assembler::TrustedImm32(1), valueAddress); That's one instruction on x86. On ARM it generates the same code as you wrote.
Antti Koivisto
Comment 5
2016-04-15 00:07:15 PDT
Created
attachment 276464
[details]
patch
Antti Koivisto
Comment 6
2016-04-15 00:42:15 PDT
> It would likely be better to do: > element ->nextElementSibling() == last.element > to avoid touching the memory of last.element again.
Good idea. Did this also on the compiler path.
Antti Koivisto
Comment 7
2016-04-15 00:56:09 PDT
http://trac.webkit.org/changeset/199583
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