Skip to content
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

Feat - Use buffer pool in AudioWorkletGlobalScope #132

Merged
merged 9 commits into from
Jun 8, 2024

Conversation

b-ma
Copy link
Collaborator

@b-ma b-ma commented Jun 7, 2024

Built on top of #131

  1. Use a buffer pool in worklets to minimize allocations
  2. Ensure that input and output cannot be transfered to main thread
  RESULTS:
  - # pass: 7299
  - # fail: 527
  - # type error issues: 3
> wpt duration: 2:50.251 (m:ss.mmm)

@b-ma b-ma requested a review from orottier June 7, 2024 15:47
Copy link
Collaborator

@orottier orottier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, it's quite a bit of extra code (or framed differently: attack surface for bugs) but I guess if it helps real-time safety we should do it.
Looks good to me.

return this.#pool.pop();
}

recycle(buffer) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to set the values to zero because on each render call we copy all input values anyway?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup!

@b-ma b-ma merged commit 4dd9996 into main Jun 8, 2024
5 checks passed
@b-ma b-ma deleted the feat/worklet-buffer-pool branch June 8, 2024 18:00
@b-ma b-ma mentioned this pull request Jun 9, 2024
12 tasks
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.

None yet

2 participants