Closed
Bug 997870
Opened 10 years ago
Closed 9 years ago
OscillatorNode custom waveform optimizations
Categories
(Core :: Web Audio, defect)
Core
Web Audio
Tracking
()
RESOLVED
FIXED
mozilla37
People
(Reporter: rillian, Assigned: padenot)
Details
Attachments
(2 files, 3 obsolete files)
1.76 KB,
text/html
|
Details | |
3.54 KB,
patch
|
Details | Diff | Splinter Review |
Testing recently I noticed that Firefox is an order of magnitude slower than chrome at the attached benchmark page, both on mobile and on desktop. We should do better.
Comment 1•10 years ago
|
||
This testcase uses a constant fundamental frequency, so in this case the wave data need only be fetched once for the block, which is what blink does, instead of fetching for each sample.
Assignee | ||
Comment 2•10 years ago
|
||
Looking at Ralph's benchmark, I noticed it repeatedly creates OfflineAudioContext that are 10 sample-frames long (the second argument of OffineAudioContext is in frames, not seconds). As it happens, we have a greater overhead on OfflineAudioContext creation/completion than Chrome, and it accounted for most of the slowdown. A more realistic benchmark for PeriodicWave would be to have an OfflineAudioContext set to a super-long duration (I used 1000 seconds, that renders in 2.7 seconds or so), and only have one repetition. Doing that, we see that we are in the same magnitude (a factor of around 5 in favor of Chrome). Applying this patch, we are only twice a slow. This patch basically adds a return value to UpdateParametersIfNeeded so we now know if we need to refetch the wavetable. I'm sure we can make it better, but since we are switching basic waveforms to WaveTables, I'd felt like making sure performance were not regressing a lot.
Attachment #8534346 -
Flags: review?(karlt)
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → padenot
Status: NEW → ASSIGNED
Comment 3•10 years ago
|
||
Comment on attachment 8534346 [details] [diff] [review] Optimize ComputeCustom a little. r= >- UpdateParametersIfNeeded(ticks, i); >+ bool needWavetableUpdate = i == aStart ? true : UpdateParametersIfNeeded(ticks, i); I expect we still need to call UpdateParametersIfNeeded() when i == aStart.
Attachment #8534346 -
Flags: review?(karlt) → review-
Assignee | ||
Comment 4•10 years ago
|
||
Attachment #8534972 -
Flags: review?(karlt)
Comment 5•10 years ago
|
||
Comment on attachment 8534972 [details] [diff] [review] Optimize ComputeCustom a little. r= > double frequency, detune; > > bool simpleFrequency = mFrequency.HasSimpleValue(); > bool simpleDetune = mDetune.HasSimpleValue(); > > // Shortcut if frequency-related AudioParam are not automated, and we > // already have computed the frequency information and related parameters. >- if (simpleFrequency && simpleDetune && !mRecomputeParameters) { >+ if (ConstantFrequencyForThisBlock()) { > return; > } Now that simpleFrequency and simpleDetune are unused before the early return, can you move the early return up, please? >+ bool ConstantFrequencyForThisBlock() Please change the function name to clarify that it is also considering whether things have changed since UpdateParametersIfNeeded() was last called. Perhaps ParametersMayNeedUpdate(), with inverse meaning of the result.
Attachment #8534972 -
Flags: review?(karlt) → review+
Assignee | ||
Comment 6•10 years ago
|
||
Update to last version, with comments addressed.
Assignee | ||
Updated•10 years ago
|
Attachment #8534972 -
Attachment is obsolete: true
Assignee | ||
Comment 7•10 years ago
|
||
Assignee | ||
Updated•10 years ago
|
Attachment #8535569 -
Attachment is obsolete: true
Assignee | ||
Comment 8•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/187fa323cec6
Assignee | ||
Comment 9•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/7978b241bf5e
Assignee | ||
Comment 10•9 years ago
|
||
relanded https://hg.mozilla.org/integration/mozilla-inbound/rev/b7303f56216b
Comment 11•9 years ago
|
||
Comment on attachment 8536595 [details] [diff] [review] Optimize ComputeCustom a little. r= >- UpdateParametersIfNeeded(ticks, i); > mPeriodicWave->waveDataForFundamentalFrequency(mFinalFrequency, > lowerWaveData, > higherWaveData, > tableInterpolationFactor); >+ mPeriodicWave->waveDataForFundamentalFrequency(mFinalFrequency, >+ lowerWaveData, >+ higherWaveData, >+ tableInterpolationFactor); >+ UpdateParametersIfNeeded(ticks, i); Need to do UpdateParametersIfNeeded() before waveDataForFundamentalFrequency() to set mFinalFrequency.
Updated•9 years ago
|
Attachment #8534346 -
Attachment is obsolete: true
Comment 12•9 years ago
|
||
Something in this push made test_periodicWave.html permafail. Backed out. https://hg.mozilla.org/integration/mozilla-inbound/rev/72d7ae169b09 https://treeherder.mozilla.org/logviewer.html#?job_id=5080110&repo=mozilla-inbound
Assignee | ||
Comment 13•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/894be64b069b
https://hg.mozilla.org/mozilla-central/rev/894be64b069b
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
You need to log in
before you can comment on or make changes to this bug.
Description
•