Closed
Bug 606879
Opened 15 years ago
Closed 14 years ago
TM: some double values should be integers in audio-fft
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: n.nethercote, Assigned: n.nethercote)
Details
The hottest loop in audio-fft looks like this:
while ( i < bufferSize ) {
off = i + halfSize;
tr = (currentPhaseShiftReal * real[off]) - (currentPhaseShiftImag * imag
[off]);
ti = (currentPhaseShiftReal * imag[off]) + (currentPhaseShiftImag * real
[off]);
real[off] = real[i] - tr;
imag[off] = imag[i] - ti;
real[i] += tr;
imag[i] += ti;
i += halfSize << 1;
}
'i' and 'halfSize' are loaded as doubles. The result is that 'i' and 'off' have to be converted to integers with code like this:
d2i2 = d2i $stack13
i2d2 = i2d d2i2
eqd2 = eqd $stack13, i2d2
xf9: xf eqd2 -> pc=0x93a8687 imacpc=(nil) sp+32 rp+0 (GuardID=019)
and halfSize has to be converted with a call to js_DoubleToInt32().
I'm not sure why these variables are treated as doubles. The only double-ish use I can see is that 'i' is assigned like this elsewhere:
i = bufferSize/2;
Maybe that's the problem.
If we can fix this I roughly estimate a 5--10% speedup based on Cachegrind numbers. audio-beat-detection will be sped up similarly because it's practically identical to audio-fft (see bug 603837).
| Assignee | ||
Comment 1•15 years ago
|
||
The stability info at the end of this fragment looks like this:
Stability of fragment 0x93075a4:
ENTRY STACK=FOONOIOOOOOOIIIIDIIIDDUI GLOBALS=OOFO
Stability of fragment 0x937729c:
ENTRY STACK=FOONODOOOOOODDDDDDDDDDDD GLOBALS=OOFO
Stability of fragment 0x934211c:
ENTRY STACK=FOONODOOOOOODDDDDDDDDDUD GLOBALS=OOFO
Stability of fragment 0x93da404:
ENTRY STACK=FOONODOOOOOODDDDDDDUUUUD GLOBALS=OOFO
Stability of fragment 0x931c3cc:
ENTRY STACK=FOONOIOOOOOOIIIDDDDIDDDI GLOBALS=OOFO
Stability of fragment 0x93198e4:
ENTRY STACK=FOONOIOOOOOOIIIDDDIIDDDI GLOBALS=OOFO
Stability of fragment 0x9316d94:
ENTRY STACK=FOONOIOOOOOOIIIDDDDIDDII GLOBALS=OOFO
Stability of fragment 0x93142bc:
ENTRY STACK=FOONOIOOOOOOIIIDDIIIDDDI GLOBALS=OOFO
Stability of fragment 0x931174c:
ENTRY STACK=FOONOIOOOOOOIIIDIDIIDDII GLOBALS=OOFO
Stability of fragment 0x930ebfc:
ENTRY STACK=FOONOIOOOOOOIIIDIIIIDDII GLOBALS=OOFO
Recording completed at /home/njn/moz/kraken-njn/tests/kraken-1.0/audio-fft-data.js:334@287 via closeLoop (FragID=000029)
Presumably this is relevant; I don't yet understand how stack variables have types assigned.
| Assignee | ||
Comment 2•14 years ago
|
||
TM's days are numbered: WONTFIX.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•