Closed
Bug 1370208
Opened 8 years ago
Closed 8 years ago
Inline Boolean when called as a function
Categories
(Core :: JavaScript Engine: JIT, enhancement)
Core
JavaScript Engine: JIT
Tracking
()
RESOLVED
FIXED
mozilla55
Tracking | Status | |
---|---|---|
firefox55 | --- | fixed |
People
(Reporter: anba, Assigned: anba)
Details
Attachments
(1 file, 1 obsolete file)
5.74 KB,
patch
|
anba
:
review+
|
Details | Diff | Splinter Review |
I saw this in a Speedometer/React profile and it should be easy enough to inline in MCallOptimize using IonBuilder::convertToBoolean(...).
Comment 1•8 years ago
|
||
(In reply to André Bargull from comment #0)
> I saw this in a Speedometer/React profile and it should be easy enough to
> inline in MCallOptimize using IonBuilder::convertToBoolean(...).
Can you provide more information, with ideally a micro benchmark which highlight the issue?
Assignee | ||
Comment 2•8 years ago
|
||
var q = 0;
var inputs = [true, false, 0, 1, "", "awd", null, {}];
var t = Date.now();
for (var i = 0; i < 10000000; ++i) {
if (Boolean(inputs[i & 0x7])) q++;
}
print(Date.now() - t, q);
Would improve from 125ms to ~30ms (same number as V8, which also optimizes calls to the Boolean constructor -> https://github.com/v8/v8/blob/a234136074366a8ab8d1c703bad1949ec5a1f033/src/compiler/js-call-reducer.cc#L67-L81).
FWIW in Speedometer, this React function seems to cause most Boolean calls: https://github.com/facebook/react/blob/0.14-stable/src/renderers/shared/reconciler/ReactCompositeComponent.js#L689
Assignee | ||
Comment 3•8 years ago
|
||
The patch used for comment #2.
Do you think this makes sense to optimize?
Attachment #8874444 -
Flags: feedback?(nicolas.b.pierron)
Comment 4•8 years ago
|
||
Comment on attachment 8874444 [details] [diff] [review]
bug1370208.patch
Review of attachment 8874444 [details] [diff] [review]:
-----------------------------------------------------------------
::: js/src/jit/MCallOptimize.cpp
@@ +904,5 @@
>
> IonBuilder::InliningResult
> +IonBuilder::inlineBoolean(CallInfo& callInfo)
> +{
> + if (callInfo.argc() != 1 || callInfo.constructing()) {
nit/follow-up: It seems that the 0 argument case, or more than one case should be easy to implement as well.
http://searchfox.org/mozilla-central/source/js/src/jsbool.cpp#116
Attachment #8874444 -
Flags: feedback?(nicolas.b.pierron) → review+
Assignee | ||
Comment 5•8 years ago
|
||
Relaxed arguments check to allow only number of arguments per comment #4. Carrying r+.
Attachment #8874444 -
Attachment is obsolete: true
Attachment #8874744 -
Flags: review+
Assignee | ||
Comment 6•8 years ago
|
||
Try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=5c2f4711c9d7c5e898216a8a1a893dded9170aa5
Keywords: checkin-needed
Pushed by cbook@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/f302f3481aaa
Inline Boolean constructor when called as a function. r=nbp
Keywords: checkin-needed
Comment 8•8 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
status-firefox55:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in
before you can comment on or make changes to this bug.
Description
•