Closed Bug 1163958 Opened 10 years ago Closed 10 years ago

Reduce the allocation in MediaStreamGraph

Categories

(Core :: Web Audio, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla41
Tracking Status
firefox41 --- fixed

People

(Reporter: baku, Assigned: baku)

References

Details

(Keywords: perf)

Attachments

(2 files, 3 obsolete files)

Attached patch e.patch (obsolete) — Splinter Review
Often we create temporary arrays to store part of the graph. We should try to avoid this because that can cause allocation.
Attachment #8604587 - Flags: review?(padenot)
Keywords: perf
This first patch contains also some indentation things. If you prefer I can split it in another patch.
Attached patch f.patch (obsolete) — Splinter Review
This patch manly introduces StreamBuffer::GetAndResetTracksDirty() and that is used to do or not to do all the MediaStreamGraphImpl::CreateOrDestroyAudio logic.
Attachment #8604607 - Flags: review?(padenot)
Attached patch f.patch (obsolete) — Splinter Review
Attachment #8604607 - Attachment is obsolete: true
Attachment #8604607 - Flags: review?(padenot)
Attachment #8604622 - Flags: review?(padenot)
Attached patch f.patchSplinter Review
This patch reverts some changes done in previous patches. The new logic was not fully correct. (but the tests pass...)
Attachment #8604622 - Attachment is obsolete: true
Attachment #8604622 - Flags: review?(padenot)
Attachment #8604707 - Flags: review?(padenot)
Attached patch e.patchSplinter Review
Ah.. my fault. The previous comment was about this patch. f.patch is ok.
Attachment #8604587 - Attachment is obsolete: true
Attachment #8604587 - Flags: review?(padenot)
Attachment #8604709 - Flags: review?(padenot)
Comment on attachment 8604707 [details] [diff] [review] f.patch Review of attachment 8604707 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/media/StreamBuffer.cpp @@ +82,5 @@ > + > + if (mTracks[middle]->GetID() > aID) { > + right = middle - 1; > + } else { > + left = middle + 1; Maybe we can simply use https://dxr.mozilla.org/mozilla-central/source/xpcom/glue/nsTArray.h?from=nsTArray.h#1146 since mTracks is an nsTArray ?
Attachment #8604707 - Flags: review?(padenot) → review+
Attachment #8604709 - Flags: review?(padenot) → review+
> Maybe we can simply use > https://dxr.mozilla.org/mozilla-central/source/xpcom/glue/nsTArray. > h?from=nsTArray.h#1146 since mTracks is an nsTArray ? That returns the offset of a known item. I didn't find a binary search implementation for nsTArray that matches this case.
(In reply to Andrea Marchesini (:baku) from comment #7) > > Maybe we can simply use > > https://dxr.mozilla.org/mozilla-central/source/xpcom/glue/nsTArray. > > h?from=nsTArray.h#1146 since mTracks is an nsTArray ? > > That returns the offset of a known item. I didn't find a binary search > implementation for nsTArray that matches this case. I'm pretty sure you can use the nsTArray version, but even if you couldn't, you could at least use the underlying implementation it's based on: http://mxr.mozilla.org/mozilla-central/source/mfbt/BinarySearch.h#45
Depends on: 1216417
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: