-description method consumes 22ms on every call to -[BrowserCrApplication sendEvent:] |
||
Issue descriptionThe Stack Sampler shows that the call to [event description] in -[BrowserCrApplication sendEvent:] (to build the crash key) takes 22ms. Is it possible to build the description by hand to avoid this overhead?
,
Oct 2 2017
It's the -description method. That method calls -stringWithFormat: and -appendFormat: which in my experience are not very efficient.
,
Apr 2 2018
With https://chromium-review.googlesource.com/c/chromium/src/+/990155, some timings from typical events (mouse, key, kit-defined). The DescriptionForNSEvent() impl is more than 2x as fast. -[NSEvent description] = 8e-05 s DescriptionForNSEvent() = 2.3e-05 s -[NSEvent description] = 4.3e-05 s DescriptionForNSEvent() = 2e-05 s -[NSEvent description] = 4.4e-05 s DescriptionForNSEvent() = 2e-05 s -[NSEvent description] = 4.3e-05 s DescriptionForNSEvent() = 2.1e-05 s -[NSEvent description] = 5.5e-05 s DescriptionForNSEvent() = 1.9e-05 s -[NSEvent description] = 6.5e-05 s DescriptionForNSEvent() = 2.2e-05 s -[NSEvent description] = 5.8e-05 s DescriptionForNSEvent() = 2e-05 s -[NSEvent description] = 4.7e-05 s DescriptionForNSEvent() = 2.1e-05 s -[NSEvent description] = 4.2e-05 s DescriptionForNSEvent() = 2e-05 s -[NSEvent description] = 5.3e-05 s DescriptionForNSEvent() = 2e-05 s -[NSEvent description] = 0.000101 s DescriptionForNSEvent() = 2.2e-05 s -[NSEvent description] = 5.9e-05 s DescriptionForNSEvent() = 2e-05 s
,
Apr 2 2018
(N.B. that was in a debug build, so release is probably faster)
,
Apr 2 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/916a7194d0b74077d168417ef2ef2b77384bd5f4 commit 916a7194d0b74077d168417ef2ef2b77384bd5f4 Author: Robert Sesek <rsesek@chromium.org> Date: Mon Apr 02 18:55:12 2018 [Mac] Speed up capturing the "nsevent" crash key. Using -[NSEvent description] can be slow, so instead build a description string manually. This contains just the information that is useful in crash analysis, so it's faster. Bug: 770405 Change-Id: Ib4e0fd54daa0412f4f8c1e3d500d1f048f0940f8 Reviewed-on: https://chromium-review.googlesource.com/990155 Reviewed-by: Erik Chen <erikchen@chromium.org> Commit-Queue: Robert Sesek <rsesek@chromium.org> Cr-Commit-Position: refs/heads/master@{#547476} [modify] https://crrev.com/916a7194d0b74077d168417ef2ef2b77384bd5f4/chrome/browser/chrome_browser_application_mac.mm
,
Apr 10 2018
Looking at the sampling profiler now, the time spent in -sendEvent: has reduced by -0.276%. And formatting the crash key now ranks below the actual event handler. |
||
►
Sign in to add a comment |
||
Comment 1 by rsesek@chromium.org
, Oct 2 2017