Closed Bug 1171441 Opened 9 years ago Closed 7 months ago

Add a way to determine if an AudioParam is constant for a block

Categories

(Core :: Web Audio, defect, P3)

defect

Tracking

()

RESOLVED FIXED
119 Branch
Tracking Status
firefox119 --- fixed

People

(Reporter: padenot, Assigned: karlt)

References

(Blocks 3 open bugs)

Details

(Keywords: perf, perf-alert)

Attachments

(7 files)

This is a nice optimization, since sometimes, having the param value that changes induces costly recomputations.

This is especially necessary since `AudioParam.value` now adds a timeline event.
Blocks: webaudioperf
Rank: 25
Keywords: perf
Priority: -- → P2
Depends on: 1184057
Depends on: 1497112
Severity: normal → S3
Blocks: 1308435

An approximation of this is to have a simple value recorded on the AudioEventTimeline when there are no further events in the future and the last event in the past is not a SetTarget.
This would address the common case of events having already passed, and would be sufficient to address the case of making the value setter behave like setValueAtTime().
It is an easy case to detect because once the event is known simple, no further analysis of events is required (until another event is added).

This approach of comment 2 provides benchmark time reductions of 64 - 73% on Stereo Panning with Automation, 24 - 30% on Granular synthesis, 13 - 29% on Periodic Wave with Automation, and 6 - 20 % on Substractive synth.

A regression of 18% was reported on the "Stereo Panning" benchmark only on 32-bit WINNT. However, running the same comparison without the larger benchmarks, "Granular synthesis", "Synth", and "Substractive synth", does not show the same regression, implying that the apparent regression was a bleeding of one benchmark's work into another, perhaps a result of GC after the more complex graphs. The last benchmarks run in this order: "Granular synthesis", "Synth", "Substractive synth", "Stereo Panning", "Stereo Panning with Automation", "Periodic Wave with Automation".

See Also: → 1853597
Assignee: nobody → karlt
Status: NEW → ASSIGNED

mSetValue might be a more accurate name right now, but this will be the
default value when bug 1308435 is fixed. Its purpose will be to record the
value to return when there are no events, including when events have been
removed.

Depends on D188938

This retains some double precision from mDuration instead of truncating
mDuration.

Event start times are already rounded to ticks, so perhaps the end time could
be also, but that would require some care with end time out of range of
int64_t. These uses always have a subsequent event and so the end time would
not be out of range.

Changes in rendering are expected to be minor.

Depends on D188941

so that they can be used outside of GetValuesAtTimeHelperInternal() in a
subsequent patch.

Depends on D188942

Pushed by ktomlinson@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f22fd10b14cc
rename AudioEventTimeline::mValue to mDefaultValue r=padenot
https://hg.mozilla.org/integration/autoland/rev/c23bf75d074e
unify handling of no next event and ignored next event r=padenot
Pushed by ktomlinson@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d57a6e27f79e
clarify distinction between start and end time of event r=padenot
https://hg.mozilla.org/integration/autoland/rev/5ce53217bf3e
use double type for end time of event r=padenot
Pushed by ktomlinson@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4d85ecdd90eb
move end time and value functions to AudioTimelineEvent r=padenot
Pushed by ktomlinson@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/e4787339734b
use simple AudioEventTimeline value when it has a suitable single event r=padenot
Blocks: 1184057
No longer depends on: 1184057
Pushed by ktomlinson@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7056fe8e144d
remove unused CancelAllEvents() r=padenot

(In reply to Pulsebot from comment #14)

Pushed by ktomlinson@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/e4787339734b
use simple AudioEventTimeline value when it has a suitable single event
r=padenot

== Change summary for alert #39690 (as of Thu, 28 Sep 2023 09:21:09 GMT) ==

Improvements:

Ratio Test Platform Options Absolute values (old vs new) Performance Profiles
8% webaudio macosx1015-64-shippable-qr fission webrender 98.25 -> 89.92 Before/After
8% webaudio linux1804-64-shippable-qr fission webrender 116.50 -> 106.83 Before/After
8% webaudio linux1804-64-shippable-qr fission webrender 117.17 -> 107.75 Before/After
7% webaudio windows10-64-shippable-qr fission webrender 91.83 -> 85.25

For up to date results, see: https://treeherder.mozilla.org/perfherder/alerts?id=39690

Keywords: perf-alert
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: