Closed Bug 454037 Opened 16 years ago Closed 16 years ago

TM: perf problems on "funo" js benchmark with parseInt(float)

Categories

(Core :: JavaScript Engine, defect)

x86
Windows Vista
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: dvander, Assigned: dvander)

References

()

Details

Attachments

(1 file)

Are we aborting trace?
on parseInt() we don't trace because a number is being passed instead of a string.
Thats awesome. Can you whip up a patch to special-case this? (no-op). We will be very fast on this one ;)
Quick patch, from IRC there was a sort-of consensus that parseInt on a double became a Math.floor() with checks for infinite values (which have to become NaN).  With this my test machine went from 3877ms to 46ms (type specialization rocks!)

Will do a separate patch for parseInt(int) as I'd like to make a slightly more involved structure for no-op natives.
Attachment #337266 - Flags: review?(gal)
Comment on attachment 337266 [details] [diff] [review]
proposed patch for parseInt(double)

The opening brace after the if is desperately calling to be moved one line up.
Attachment #337266 - Flags: review?(gal) → review+
(In reply to comment #5)
> (From update of attachment 337266 [details] [diff] [review])
> The opening brace after the if is desperately calling to be moved one line up.

And then apply the brace minimization filter ;-).

/be
Or how about this:

return JS_DOUBLE_IS_FINITE(d) ? js_NaN : floor(d);

/me runs and ducks before shaver sees this.
Yeah, then the ?: rewrite filter -- I'm not kidding, one liners like this are better in my book.

/be
See also bug 453402; as in that bug, I think we want different bugs for the different slow cases.

(I think Andreas' one-liner, for all its terse glory, is perhaps backwards?)
Summary: TM: perf problems on a benchmark → TM: perf problems on "funo" js benchmark with parseInt(float)
For what it's worth, the concat benchmark is basically spending all its time in/under js_ConcatStrings.  Some JS_malloc, some js_NewString, some js_strncpy.  That pretty much accounts for all of it.

Not sure what v8 is doing here other than perhaps realizing that the whole thing is a no-op...
Flags: wanted1.9.1?
Suspect that they're refcounting strings, and/or using a multi-segment string implementation internally.  Haven't had time to check, though. :)
Yeah....  I spent some time poking through their code, but can't even find the string implementation, so much.  There's the string.js thing which they presumably jit and all, but I can't find the string backend.
runtime.cc's StringAdd leads to Heap::AllocateConsString for not-tiny strings, indeed.
For the string concat issue, the test concats two static strings, for which I expect a smart JIT compiler to detect this situation, optimizing the add of two constants into one new constant.

A long time, I developed an interpreter (DScheme) that did this kind of 'inline' formula optimization when translating a formula to a bytecode stream, so this should also be possible for JavaScript.

Can this be taken up in a separate bug?
We already jit into the string concatenation built-in.  The time in that test is taken purely by allocating the new string object and copying in the data.
Blocks: js-perf
See bug 453402 for the string concat issue.
Fix for parseInt(double) was pushed to m-c with last night's merge.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Flags: in-testsuite-
Flags: in-litmus-
Depends on: 507993
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: