Project: chromium Issues People Development process History Sign in
New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 1 user
Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Nov 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocking:
issue 351146
issue 451347



Sign in to add a comment
Add TRACE to Custom Elements
Project Member Reported by dominicc@chromium.org, Oct 27 2016 Back to list
See Issue 451347. Here I'm forking off the custom element part.

I'm not sure what the right granularity is for trace events. Nat, can you guide me?

Here's ones which should be a no-brainer I think:

- super() (Sadly, expensive.)
- define() If this is slow it will be upgrade. We could break that out separately but not sure it's interesting to do that.

One I'm less sure about:

- Callback by element type. These could be chatty. On the other hand if you have a bunch of custom elements running around and "it's slow" then I imagine that would be a useful breakdown to have.

sorvell, do you have ideas? Could you loop in other Polymon who've worked on custom element perf and have a wishlist?
 
Blocking: 351146
Tentative patch up at https://codereview.chromium.org/2459443004

Feedback welcome on what would be useful. I think you learn a lot by tracing your V8 methods, or is overhead of eg custom element reaction dispatch itself of interest?
Project Member Comment 3 by bugdroid1@chromium.org, Nov 1 2016
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/82e96780380b30193a27d412282cda8ca103c382

commit 82e96780380b30193a27d412282cda8ca103c382
Author: dominicc <dominicc@chromium.org>
Date: Tue Nov 01 03:23:50 2016

Add tracing to custom elements operations

This adds traces in the 'blink' category to:

- customElements.define (which could take arbitrarily long given upgrades)
- HTMLConstructor (which is unavoidable cost per-instance, so of interest)
- reaction queue invoking (you could probably work this out from JS stacks, but
  it is an interesting landmark and its overhead may be of interest)

BUG= 659918 

Review-Url: https://codereview.chromium.org/2459443004
Cr-Commit-Position: refs/heads/master@{#428924}

[modify] https://crrev.com/82e96780380b30193a27d412282cda8ca103c382/third_party/WebKit/Source/bindings/core/v8/V8HTMLConstructor.cpp
[modify] https://crrev.com/82e96780380b30193a27d412282cda8ca103c382/third_party/WebKit/Source/core/dom/custom/CustomElementReactionQueue.cpp
[modify] https://crrev.com/82e96780380b30193a27d412282cda8ca103c382/third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp

Status: Fixed
Now you can go to chrome://tracing and turn on the 'blink' category and look for:

HTMLConstructor <-- time spent in "super()"
CustomElementReactionQueue::invokeReactions <-- callbacks incl dispatch overhead
CustomElementRegistry::define <-- define including in-document upgrade

invokeReactions and define have a 'name' property that tells you the custom element name eg x-foo. It's not easy to do that for super() but it should be possible to work out which element it is from the JavaScript stack above the event.

I'm closing this for now, but please let me know if you need more/different/etc.

These traces might be useful in pursuit of Issue 351146.
Sign in to add a comment