Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Issue 2073763002: Performance fix for H264 RBSP parsing. (Closed)

Created:
4 years, 6 months ago by sprang_webrtc
Modified:
4 years, 6 months ago
Reviewers:
pbos-webrtc, mflodman
CC:
webrtc-reviews_webrtc.org, tterriberry_mozilla.com
Base URL:
https://chromium.googlesource.com/external/webrtc.git@master
Target Ref:
refs/pending/heads/master
Project:
webrtc
Visibility:
Public.

Description

Performance fix for H264 RBSP parsing. An rtc::Buffer is used to write output of RBSP parsing, usually one byte at a time. It turns out that container will then expand its capacity one byte at a time, for each byte reallocating the whole buffer and copying the contents over, turning this into an O(n^2) operation. Fix is for now only to preallocate the container storage. Longer term, I think we should mull over if we really need custom containers... R=pbos@webrtc.org TBR=mflodman@webrtc.org BUG= Committed: https://crrev.com/1642620a7d9fef7c1dca3bb0d7b172debe3b3d4c Cr-Commit-Position: refs/heads/master@{#13167}

Patch Set 1 #

Patch Set 2 : Missing include in base/buffer.h #

Unified diffs Side-by-side diffs Delta from patch set Stats (+3 lines, -1 line) Patch
M webrtc/base/buffer.h View 1 1 chunk +1 line, -0 lines 0 comments Download
M webrtc/common_video/h264/h264_common.cc View 2 chunks +2 lines, -1 line 0 comments Download

Messages

Total messages: 16 (7 generated)
sprang_webrtc
4 years, 6 months ago (2016-06-16 12:15:43 UTC) #2
pbos-webrtc
lgtm, can you file a bug for this not being amortized constant?
4 years, 6 months ago (2016-06-16 12:18:31 UTC) #3
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2073763002/1
4 years, 6 months ago (2016-06-16 12:18:58 UTC) #5
commit-bot: I haz the power
Try jobs failed on following builders: ios_arm64_rel on tryserver.webrtc (JOB_FAILED, http://build.chromium.org/p/tryserver.webrtc/builders/ios_arm64_rel/builds/10559)
4 years, 6 months ago (2016-06-16 12:30:28 UTC) #7
sprang_webrtc
+mflodman as owner for webrtc/base
4 years, 6 months ago (2016-06-16 13:24:35 UTC) #9
sprang_webrtc
Committed patchset #2 (id:20001) manually as 1642620a7d9fef7c1dca3bb0d7b172debe3b3d4c (presubmit successful).
4 years, 6 months ago (2016-06-16 13:55:04 UTC) #12
tommi
wrt to custom containers, I think that preallocating is still appropriate. Even if there's an ...
4 years, 6 months ago (2016-06-16 21:13:30 UTC) #14
sprang_webrtc
On 2016/06/16 21:13:30, tommi-webrtc wrote: > wrt to custom containers, I think that preallocating is ...
4 years, 6 months ago (2016-06-17 07:46:58 UTC) #15
pbos-webrtc
4 years, 6 months ago (2016-06-17 08:30:40 UTC) #16
Message was sent while issue was closed.
On 2016/06/17 07:46:58, språng wrote:
> On 2016/06/16 21:13:30, tommi-webrtc wrote:
> > wrt to custom containers, I think that preallocating is still appropriate. 
> Even
> > if there's an algorithm that reduces the amount of reallocations but is
still
> > guesswork, if we already know how much we'll need, allocating once will beat
> any
> > such algorithm.
> 
> Try, preallocating is always preferable, but it's still very dangerous to just
> assume that this will always be done and seriously degrade performance
> otherwise.
> I've filed https://bugs.chromium.org/p/webrtc/issues/detail?id=6009
> 
> As for my comment about containers, that was just a general remark in the
> context
> of moving away from our own implementations to stl things where it makes
sense,
> such as scoped_ptr -> unique_ptr. Note sure what's new with std::vector et al

If we don't do 2x growth, then I think it should crash on AppendData if that's
out of bounds for the stored capacity, or log serious warnings.

Powered by Google App Engine
This is Rietveld 408576698