Closed Bug 511737 Opened 15 years ago Closed 15 years ago

TM: fast path for writing a double into an array

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
status1.9.2 --- beta1-fixed

People

(Reporter: gal, Assigned: gal)

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file)

4ms speedup on SS. Its a 2% speedup or so for about a third of the test cases. I renew my call for more profiling.
Attached patch patchSplinter Review
Assignee: general → gal
Attachment #395665 - Flags: review?(dvander)
Attachment #395665 - Flags: review?(dvander) → review+
:) nice work
(In reply to comment #0)
> 4ms speedup on SS. 

I don't trust SS's results enough to present them as definitively as that.  I have regularly seen changes that should not affect performance at all ~5ms variation, presumably due to slightly different code layouts causing different interactions with caches, branch predictors, etc.  I don't trust any optimisation until I've seen it give a speed-up on at least two configurations (eg. I 'hg pull -u' and the speed-up is still present).

And even on a single configuration, using --runs=100 on my Mac I often see variations of 2--3ms from run to run.
Yes, our benchmarks are pretty lame. Yes, we discuss that in every other bug. The patch removes a bunch of spilling between two function calls in LIR and allows GCC to inline the box code into the array set path. Except if those instructions are all free (along with the memory access hat happens), I am pretty confident that this is N cycles faster than before. Can we agree at least on that?
(In reply to comment #4)
> Can we agree at least on that?

Sure :)
should be easy to write a microbenchmark to prove out this optimization, if we want to do that.
(In reply to comment #6)
> should be easy to write a microbenchmark to prove out this optimization, if we
> want to do that.

I was about to suggest that. Or taking the SS benchmark that is most improved by this patch and increasing the run length by 10-100x.
test case:

var a = [];
for (var i = 0; i < 10000000; ++i)
    a[1] = 1.5;

without:

real	0m0.522s
user	0m0.392s
sys	0m0.127s

with:

real	0m0.477s
user	0m0.346s
sys	0m0.126s
I added a missing INT_FITS_INTO_JSVAL. Pushing with that.
http://hg.mozilla.org/tracemonkey/rev/21b21088c0ef
Whiteboard: fixed-in-tracemonkey
http://hg.mozilla.org/mozilla-central/rev/21b21088c0ef
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: