WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED CONFIGURATION CHANGED
118636
Make element.innerHTML='' fast, as it's a common pattern on the web
https://bugs.webkit.org/show_bug.cgi?id=118636
Summary
Make element.innerHTML='' fast, as it's a common pattern on the web
Ryosuke Niwa
Reported
2013-07-12 23:13:46 PDT
Merge
https://chromium.googlesource.com/chromium/blink/+/b76f92e9a78b9bfc10080fc7e51fd049a7f0c5dd
This was brought to my attention via:
http://jsperf.com/innerhtml-vs-removechild/47
Tested by: PerformanceTests/Parser/empty-innerHTML.html
Attachments
Add attachment
proposed patch, testcase, etc.
Ryosuke Niwa
Comment 1
2013-07-12 23:19:56 PDT
Reverted in
https://chromium.googlesource.com/chromium/blink/+/de52e5c59664ae97d4e7929e4b3046830f9a2765
.
Ahmad Saleem
Comment 2
2022-08-12 09:48:31 PDT
Link -
https://jsfiddle.net/8fsL9n3o/show
If you open with "full page", it does hang the Safari tab and quite slow compared to other browser but eventually complete and show this: Time: values 1210.592686002522, 1191.0669975186097, 1221.3740458015268, 1221.3740458015275, 1219.8221092757306, 1.8087271082975356, 1.7591696719148562, 259.7402597402597, 263.4467618002195, 239.76023976023976, 259.4594594594595, 259.7402597402597, 34.188034188033974, 31.2256049960968, 33.208800332088, 33.52891869237217, 34.63203463203463, 261.437908496732, 264.6085997794928, 262.8696604600303 runs/s avg 415.2822161628724 runs/s median 259.7402597402597 runs/s stdev 483.8794386569932 runs/s min 1.7591696719148562 runs/s max 1221.3740458015275 runs/s *** Safari Technical Preview 151 within JSFiddle *** Time: values 1.8744142455482662, 1.8433179723502304, 1.8552875695732838, 1.8433179723502304, 1.845018450184502, 266.9322709163347, 268.6170212765957, 266.31158455392807, 274.6666666666667, 270.6666666666667, 272, 272, 272.24435590969455, 272, 272.6063829787234, 272, 271.63781624500734, 270.9163346613546, 272, 272 runs/s avg 203.79302280424892 runs/s median 271.27707545318094 runs/s stdev 119.63436599517415 runs/s min 1.8433179723502304 runs/s max 274.6666666666667 runs/s *** Firefox Nightly 105 with JSFiddle *** Time: values 319.1489361702128, 322.5806451612903, 327.0440251572327, 323.78580323785803, 325.4067584480601, 327.0440251572327, 327.0440251572327, 327.0440251572327, 323.3830845771144, 325, 327.8688524590164, 326.2233375156838, 326.2233375156838, 323.78580323785803, 326.2233375156838, 326.2233375156838, 323.78580323785803, 323.78580323785803, 324.18952618453864, 319.80319803198034 runs/s avg 324.7796832337655 runs/s median 325.2033792240301 runs/s stdev 2.36628407634657 runs/s min 319.1489361702128 runs/s max 327.8688524590164 runs/s *** Chrome Canary 106 *** Time: values 436.04651162711997, 72.24780998821112, 74.6268656716418, 72.88629737611804, 74.65472191118684, 72.75372862849362, 74.55731593662628, 72.85974499089254, 74.41168263419935, 72.69422989550205, 74.46016381246366, 72.92616226071102, 74.87131492746842, 72.66121707538602, 74.46016381233457, 72.25433526016423, 74.4463056021103, 73.00602299697171, 74.21150278293135, 72.98604141960331 runs/s avg 91.7011069305068 runs/s median 73.60876288995152 runs/s stdev 81.05576345493334 runs/s min 72.24780998821112 runs/s max 436.04651162711997 runs/s ________ Just wanted to share update results. If it is something worth further fine tuning, I would definitely like to see it more stable in tab and run better.
Ryosuke Niwa
Comment 3
2022-08-12 22:12:12 PDT
We have a fast path for this now.
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