Bug 250581 - Make MutableStylePropertySet::findPropertyIndex faster
Summary: Make MutableStylePropertySet::findPropertyIndex faster
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-01-13 09:35 PST by Ahmad Saleem
Modified: 2023-02-01 16:43 PST (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ahmad Saleem 2023-01-13 09:35:53 PST
Hi Team,

While going through Blink's commit, I came across potential performance optimization:

Blink Commit - https://chromium.googlesource.com/chromium/blink/+/501ce3bc186b2bf535ecf3af9f3ce973fe13fd4c

WebKit Source - https://searchfox.org/wubkat/source/Source/WebCore/css/StyleProperties.cpp#1732

Test Case - https://jsfiddle.net/uek0jp6v/show

____

Safari 16.2:

Time:
values 810.1265822784811, 812.1827411167512, 810.1265822784806, 812.1827411167503, 810.126582278481, 811.1533586818767, 811.1533586818758, 812.1827411167503, 799.0012484394498, 807.0617906683481, 804.0201005025144, 797.0112079701121, 810.1265822784792, 811.1533586818776, 804.0201005025126, 814.2493638676845, 804.0201005025126, 805.0314465408806, 804.0201005025144, 810.1265822784792 runs/s
avg 807.9538335142406 runs/s
median 810.1265822784799 runs/s
stdev 4.694468703933039 runs/s
min 797.0112079701121 runs/s
max 814.2493638676845 runs/s

Safari Technology Preview 161:

Time:
values 818.4143222506392, 821.5661103979442, 825.8064516129027, 821.5661103979476, 820.5128205128215, 818.4143222506403, 823.6808236808256, 824.7422680412391, 821.5661103979461, 819.4622279129302, 824.7422680412352, 819.462227912934, 821.56611039795, 819.4622279129302, 822.6221079691555, 820.5128205128206, 823.6808236808237, 820.5128205128206, 814.2493638676901, 820.5128205128243 runs/s
avg 821.152757938851 runs/s
median 821.0394654553843 runs/s
stdev 2.6746112198361116 runs/s
min 814.2493638676901 runs/s
max 825.8064516129027 runs/s

Chrome Canary 111:

Time:
values 17641.89950290709, 17947.737417819088, 17692.88765597556, 17818.2738536451, 17633.061988601097, 17670.682726693754, 17726.299882436077, 17611.006879299563, 17750.882505529138, 17755.35938936544, 17771.046324581424, 17777.777775101924, 17732.997481108312, 17759.838547990483, 17717.37762837202, 17558.299048133133, 17811.511698768758, 17666.248428976185, 17600, 17597.80027181929 runs/s
avg 17712.04945035617 runs/s
median 17721.83875540405 runs/s
stdev 93.3743887900673 runs/s
min 17558.299048133133 runs/s
max 17947.737417819088 runs/s

Firefox Nightly 110:

Time:
values 11546.39175257732, 11712.418300653595, 11697.127937336814, 11561.290322580646, 11591.203104786546, 11561.290322580646, 11561.290322580646, 11576.227390180879, 11591.203104786546, 11606.21761658031, 11561.290322580646, 11621.271076523995, 11576.227390180879, 11621.271076523995, 11621.271076523995, 11516.709511568124, 11621.271076523995, 11591.203104786546, 11681.877444589309, 11681.877444589309 runs/s
avg 11604.946484951737 runs/s
median 11591.203104786546 runs/s
stdev 53.314369487155936 runs/s
min 11516.709511568124 runs/s
max 11712.418300653595 runs/s

________

Just wanted to raise, so if we can merge 1-1 or if needed then take same idea and apply more optimization.

Thanks!
Comment 1 Radar WebKit Bug Importer 2023-01-20 09:36:22 PST
<rdar://problem/104479595>
Comment 2 Ahmad Saleem 2023-01-22 04:32:10 PST
These numbers are from WebKit Trunk (Release - 259178@main):

Description: Measures performance of the CSS style getter and setter methods (elem.style.(getPropertyValue|removeProperty|setProperty)).

Time:
values 14527.112232030273, 14436.09022556391, 14563.843236409608, 14508.81612090681, 14454.203262233392, 14545.454545454579, 14490.566037735865, 14563.843236409624, 14582.278481012676, 14490.566037735849, 14472.361809045226, 14563.843236409608, 14545.454545454546, 14563.84323640954, 14527.112232030231, 14582.278481012625, 14508.816120906768, 14527.112232030231, 14508.816120906835, 14563.843236409675 runs/s
avg 14526.312733305393 runs/s
median 14527.112232030253 runs/s
stdev 42.15659058359132 runs/s
min 14436.09022556391 runs/s
max 14582.278481012676 runs/s
Comment 3 Ahmad Saleem 2023-01-22 05:18:16 PST
(In reply to Ahmad Saleem from comment #2)
> These numbers are from WebKit Trunk (Release - 259178@main):
> 
> Description: Measures performance of the CSS style getter and setter methods
> (elem.style.(getPropertyValue|removeProperty|setProperty)).
> 
> Time:
> values 14527.112232030273, 14436.09022556391, 14563.843236409608,
> 14508.81612090681, 14454.203262233392, 14545.454545454579,
> 14490.566037735865, 14563.843236409624, 14582.278481012676,
> 14490.566037735849, 14472.361809045226, 14563.843236409608,
> 14545.454545454546, 14563.84323640954, 14527.112232030231,
> 14582.278481012625, 14508.816120906768, 14527.112232030231,
> 14508.816120906835, 14563.843236409675 runs/s
> avg 14526.312733305393 runs/s
> median 14527.112232030253 runs/s
> stdev 42.15659058359132 runs/s
> min 14436.09022556391 runs/s
> max 14582.278481012676 runs/s

I built with same trunk with this patch new build and these are numbers:

Description: Measures performance of the CSS style getter and setter methods (elem.style.(getPropertyValue|removeProperty|setProperty)).

Time:
values 17212.713936430326, 17297.297297297268, 17318.573185731846, 17021.27659574466, 17066.666666666646, 17066.666666666646, 16998.6719787517, 17108.140947752127, 17404.202719406636, 17276.0736196319, 17382.716049382754, 17276.073619631865, 17108.14094775205, 17361.282367447675, 17297.297297297373, 17191.697191697116, 17382.71604938256, 17276.073619631865, 17212.71393643043, 16998.671978751743 runs/s
avg 17212.883333574264 runs/s
median 17244.393778031146 runs/s
stdev 135.20902389383878 runs/s
min 16998.6719787517 runs/s
max 17404.202719406636 runs/s

It is not scientific but it does seem to give some boost. Should I do PR? Thanks!
Comment 4 Ahmad Saleem 2023-01-22 05:44:37 PST
This got redone by bug 249228. We can close this if we want to do other change of bug 249228.
Comment 5 EWS 2023-02-01 16:43:11 PST
Committed 259726@main (b98bb73bfb6f): <https://commits.webkit.org/259726@main>

Reviewed commits have been landed. Closing PR #9418 and removing active labels.