Bug 90265 - Optimize Element::removeAttribute() by replacing String with AtomicString
Summary: Optimize Element::removeAttribute() by replacing String with AtomicString
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kentaro Hara
URL:
Keywords:
Depends on:
Blocks: 90246
  Show dependency treegraph
 
Reported: 2012-06-29 02:57 PDT by Kentaro Hara
Modified: 2012-08-08 01:25 PDT (History)
5 users (show)

See Also:


Attachments
Performance test (1.63 KB, text/html)
2012-06-29 02:58 PDT, Kentaro Hara
no flags Details
Updated performance test (1.56 KB, text/html)
2012-06-29 04:55 PDT, Kentaro Hara
no flags Details
Patch (3.21 KB, patch)
2012-06-29 04:57 PDT, Kentaro Hara
webkit.review.bot: commit-queue-
Details | Formatted Diff | Diff
patch for landing (3.16 KB, patch)
2012-08-07 19:28 PDT, Kentaro Hara
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kentaro Hara 2012-06-29 02:57:57 PDT
Based on the observation described in this ChangeLog (http://trac.webkit.org/changeset/121439), the performance of Element::removeAttribute() can be optimized by replacing String with AtomicString.
Comment 1 Kentaro Hara 2012-06-29 02:58:54 PDT
Created attachment 150124 [details]
Performance test
Comment 2 Kentaro Hara 2012-06-29 04:55:00 PDT
Created attachment 150140 [details]
Updated performance test
Comment 3 Kentaro Hara 2012-06-29 04:57:02 PDT
Created attachment 150141 [details]
Patch
Comment 4 Adam Barth 2012-07-27 01:00:36 PDT
Comment on attachment 150141 [details]
Patch

#webkit tells me that AP has an opinion about this patch.
Comment 5 Adam Barth 2012-07-27 01:03:49 PDT
Based on further discussion in #webkit, my current understanding is that ap is ok with these patches.  I'm going to r+ them, but please give ap a chance to respond before landing.
Comment 6 Darin Adler 2012-07-27 07:07:46 PDT
Comment on attachment 150141 [details]
Patch

This is faster in some cases. But a case Iā€™d expect this makes slower is when the passed-in attribute name is uppercase. This adds a lookup in the atomic string table of the not-yet-lowercased string.
Comment 7 Alexey Proskuryakov 2012-07-27 09:42:21 PDT
FWIW, my comments are in bug 90246, and are not as specific as Darin's one above. I have no general objection to these patches as long as they show measurable improvement on benchmarks such as Dromaeo (not just on micro-benchmarks created just for one code path).
Comment 8 Adam Barth 2012-07-27 12:00:08 PDT
Comment on attachment 150141 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=150141&action=review

> Source/WebCore/dom/Element.cpp:1476
> -void Element::removeAttributeNS(const String& namespaceURI, const String& localName)
> +void Element::removeAttributeNS(const AtomicString& namespaceURI, const AtomicString& localName)

I see.  That doesn't seem to be a problem with this part of the change, however.
Comment 9 Adam Barth 2012-07-27 12:03:42 PDT
@Kentaro: One way to make progress here is to land the NS parts of these changes since they are a strict improvement.

For the non-NS versions, is there a measurable change on non-micro benchmarks?
Comment 10 Kentaro Hara 2012-07-27 17:36:57 PDT
(In reply to comment #9)
> @Kentaro: One way to make progress here is to land the NS parts of these changes since they are a strict improvement.
> 
> For the non-NS versions, is there a measurable change on non-micro benchmarks?

OK, let me land the NS parts. For non-NS parts I'll investigate them on Monday.
Comment 11 Kentaro Hara 2012-07-30 18:04:39 PDT
(In reply to comment #7)
>> as long as they show measurable improvement on benchmarks such as Dromaeo (not just on micro-benchmarks created just for one code path).
>>
>(In reply to comment #9)
> For the non-NS versions, is there a measurable change on non-micro benchmarks?

ap, abarth: Unfortunately, I couldn't measure it because there are no tests in Dromaeo and WebKit performance tests for getAttributeNode(), hasAttribute() and removeAttribute().

So the rationale for the patches would be (1) performance improvement in micro benchmarks and (2) code consistency (i.e. mixing String and AtomicString is confusing).
Comment 12 Kentaro Hara 2012-08-03 09:56:41 PDT
(In reply to comment #11)
> ap, abarth: Unfortunately, I couldn't measure it because there are no tests in Dromaeo and WebKit performance tests for getAttributeNode(), hasAttribute() and removeAttribute().
> 
> So the rationale for the patches would be (1) performance improvement in micro benchmarks and (2) code consistency (i.e. mixing String and AtomicString is confusing).

ap: May I land them? (For performance improvement in micro benchmarks and code consistency.)
Comment 13 Kentaro Hara 2012-08-07 18:21:28 PDT
Comment on attachment 150141 [details]
Patch

Looks like no strong objection, let me commit it.
Comment 14 WebKit Review Bot 2012-08-07 18:47:59 PDT
Comment on attachment 150141 [details]
Patch

Rejecting attachment 150141 [details] from commit-queue.

Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 2

Last 500 characters of output:
g
Hunk #1 succeeded at 1 with fuzz 3.
patching file Source/WebCore/dom/Element.cpp
Hunk #1 FAILED at 1459.
Hunk #2 succeeded at 1511 with fuzz 1 (offset 38 lines).
1 out of 2 hunks FAILED -- saving rejects to file Source/WebCore/dom/Element.cpp.rej
patching file Source/WebCore/dom/Element.h
Hunk #1 succeeded at 201 (offset 4 lines).

Failed to run "[u'/mnt/git/webkit-commit-queue/Tools/Scripts/svn-apply', u'--force', u'--reviewer', u'Adam Barth']" exit_code: 1 cwd: /mnt/git/webkit-commit-queue/

Full output: http://queues.webkit.org/results/13456289
Comment 15 Kentaro Hara 2012-08-07 19:28:54 PDT
Created attachment 157088 [details]
patch for landing
Comment 16 WebKit Review Bot 2012-08-08 01:25:00 PDT
Comment on attachment 157088 [details]
patch for landing

Clearing flags on attachment: 157088

Committed r125008: <http://trac.webkit.org/changeset/125008>