Last modified: 2014-11-05 19:40:20 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T74933, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 72933 - OOjs: v8 warns it won't optimize oo.Factory.create or oo.EventEmitter.emit
OOjs: v8 warns it won't optimize oo.Factory.create or oo.EventEmitter.emit
Status: ASSIGNED
Product: OOjs
Classification: Unclassified
General (Other open bugs)
unspecified
All All
: High enhancement
: ---
Assigned To: Editing team bugs – take if you're interested!
: performance
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-11-04 01:28 UTC by Ori Livneh
Modified: 2014-11-05 19:40 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Ori Livneh 2014-11-04 01:28:34 UTC
To reproduce:

- Navigate to an article
- Open Chrome's Developer Tools
- Click 'Profiles'
- Select 'Collect JavaScript CPU Profile'
- Click 'Start'
- Click 'Edit [beta]'
- Wait for VisualEditor to finish loading
- Click 'Stop'

Result:

Both oo.Factory.create or oo.EventEmitter.emit are flagged by the profiler with the warning: "Not optimized: Inlining bailed out."

To investigate, I recommend reading <https://github.com/GoogleChrome/devtools-docs/issues/53>

v8 comes with a 'd8' executable that can be used for getting some performance debug info from v8. If you can craft a file that utilizes these functions without depending on the DOM API, you can try running it with:

> d8 --trace-opt --trace-bailout some-js-file.js
Comment 1 Roan Kattouw 2014-11-04 20:00:01 UTC
For oo.Factory.create, my version of Chrome tells me "Not optimized: Bad value context for arguments value" which seems to be a consequence of doing args = Array.prototype.slice.call( arguments, 1 ); . I don't really see a way around that, unless there's some way of making the arguments list a real array that V8 is able to optimize.

For oo.EventEmitter.emit it does say "Inlining bailed out". I'm installing d8 now to investigate.

I saw a bunch of other "not optimized" warnings too, but most of those seem to be about try-catch statements. The only other one that jumped out at me was in oo.copy: "ForInStatement is not fast case". Will investigate that too.
Comment 2 Roan Kattouw 2014-11-05 19:40:20 UTC
EventEmitter.emit also seems to be because of arguments. I checked, though, and there's very little "self" time spent in EventEmitter.emit and Factory.create: 25ms and 53ms respectively for Obama. But I'll see what that drops to after optimizing them.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links