Skip to content

Introduce AudioProcessor::before_drop pre-destructor hook #490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 11, 2024

Conversation

orottier
Copy link
Owner

This allows the processor to send some final events, or move some items to the garbage collector thread. This will help with #368

In this commit we use the before_drop hook to ensure that the ended event is sent for all AudioScheduledSourceNodes when the stop time is implicit. This fixes #489

It is only updated from one thread and not used for synchronization
This allows the processor to send some final events, or move some items
to the garbage collector thread.

In this commit we use the before_drop hook to ensure that the ended
event is sent for all AudioScheduledSourceNodes when the stop time is
implicit. This fixes #489
@orottier
Copy link
Owner Author

/bench

@orottier orottier requested a review from b-ma April 10, 2024 18:41
Copy link

Benchmark result:


bench_ctor
  Instructions:             3326217 (-0.090261%)
  L1 Accesses:              5104643 (-0.053726%)
  L2 Accesses:                  774 (+1.842105%)
  RAM Accesses:               55238 (-0.005431%)
  Estimated Cycles:         7041843 (-0.039449%)

bench_audio_buffer_decode
  Instructions:             7373065 (No change)
  L1 Accesses:             10167885 (-0.000256%)
  L2 Accesses:                28131 (+0.096072%)
  RAM Accesses:               32201 (-0.003105%)
  Estimated Cycles:        11435575 (+0.000647%)

bench_constant_source
  Instructions:             7709084 (-0.139575%)
  L1 Accesses:             11707246 (-0.090588%)
  L2 Accesses:                  875 (+0.922722%)
  RAM Accesses:               56305 (-0.012431%)
  Estimated Cycles:        13682296 (-0.079018%)

bench_sine
  Instructions:            59346829 (-0.022955%)
  L1 Accesses:             87705382 (-0.051152%)
  L2 Accesses:               247049 (+14.77945%)
  RAM Accesses:               57015 (+0.003508%)
  Estimated Cycles:        90936152 (+0.125784%)

bench_sine_gain
  Instructions:            63822702 (-0.044885%)
  L1 Accesses:             94606058 (-0.049943%)
  L2 Accesses:               246276 (+8.428102%)
  RAM Accesses:               55248 (+0.005430%)
  Estimated Cycles:        97771118 (+0.049678%)

bench_sine_gain_delay
  Instructions:            97160784 (+0.013428%)
  L1 Accesses:            141912453 (+0.045890%)
  L2 Accesses:               444724 (-4.561774%)
  RAM Accesses:               57276 (+0.012223%)
  Estimated Cycles:       146140733 (-0.028010%)

bench_buffer_src
  Instructions:            18288868 (-0.075301%)
  L1 Accesses:             26970718 (-0.054107%)
  L2 Accesses:                81321 (+1.652521%)
  RAM Accesses:               93762 (+0.009600%)
  Estimated Cycles:        30658993 (-0.025030%)

bench_buffer_src_delay
  Instructions:            75509981 (+0.026996%)
  L1 Accesses:            106955863 (+0.045177%)
  L2 Accesses:               282317 (+1.010040%)
  RAM Accesses:               93902 (+0.015977%)
  Estimated Cycles:       111654018 (+0.056401%)

bench_buffer_src_iir
  Instructions:            79344509 (-0.021662%)
  L1 Accesses:            113879908 (-0.010619%)
  L2 Accesses:                80750 (-5.170693%)
  RAM Accesses:               93367 (+0.006427%)
  Estimated Cycles:       117551503 (-0.028829%)

bench_buffer_src_biquad
  Instructions:            56981856 (-0.056779%)
  L1 Accesses:             77391020 (-0.023634%)
  L2 Accesses:               189866 (-6.673614%)
  RAM Accesses:               93489 (+0.009628%)
  Estimated Cycles:        81612465 (-0.105100%)

bench_stereo_positional
  Instructions:            45662328 (-0.276083%)
  L1 Accesses:             69289082 (-0.236421%)
  L2 Accesses:               424993 (-1.584174%)
  RAM Accesses:               94079 (+0.013820%)
  Estimated Cycles:        74706812 (-0.264272%)

bench_stereo_panning_automation
  Instructions:            29537019 (-0.071682%)
  L1 Accesses:             44651837 (-0.052248%)
  L2 Accesses:                85102 (+3.254065%)
  RAM Accesses:               93409 (+0.003212%)
  Estimated Cycles:        48346662 (-0.020322%)

bench_analyser_node
  Instructions:            37375838 (-0.045896%)
  L1 Accesses:             52502111 (-0.033865%)
  L2 Accesses:               130255 (+1.026122%)
  RAM Accesses:               94351 (+0.004240%)
  Estimated Cycles:        56455671 (-0.019535%)

bench_hrtf_panners
  Instructions:           321982516 (-0.006385%)
  L1 Accesses:            564950099 (-0.003125%)
  L2 Accesses:             10852682 (-0.104584%)
  RAM Accesses:              120929 (-0.109036%)
  Estimated Cycles:       623446024 (-0.012684%)

bench_sine_gain_with_worklet
  Instructions:            64661655 (-0.032720%)
  L1 Accesses:             95841591 (-0.024396%)
  L2 Accesses:               217949 (+1.278828%)
  RAM Accesses:               55426 (+0.007217%)
  Estimated Cycles:        98871246 (-0.009594%)


running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s


@b-ma
Copy link
Collaborator

b-ma commented Apr 11, 2024

Really nice!

@orottier orottier merged commit 0a50410 into main Apr 11, 2024
3 checks passed
@orottier orottier deleted the feature/audio-processor-destructor branch April 11, 2024 05:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement onended events for more cases
2 participants