After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 732284 - bufferlist: optimisation: pre-allocate buffer array in one go with the buffer list
bufferlist: optimisation: pre-allocate buffer array in one go with the buffer...
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other All
: Normal enhancement
: 1.5.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-06-26 13:56 UTC by Tim-Philipp Müller
Modified: 2014-07-24 10:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
bufferlist: pre-allocate buffer array in one go with the buffer list (8.04 KB, patch)
2014-06-26 13:56 UTC, Tim-Philipp Müller
committed Details | Review

Description Tim-Philipp Müller 2014-06-26 13:56:51 UTC
Created attachment 279313 [details] [review]
bufferlist: pre-allocate buffer array in one go with the buffer list

A buffer list currently takes at least three allocs and then three frees, assuming there are no re-allocs to expand. We can allocate the buffers array in one go with the list to save these additional allocs/frees in almost all common use cases, which can easily add up to a couple of hundred malloc/frees per second saved.

Putting this here until 1.4 is out.
Comment 1 Tim-Philipp Müller 2014-07-24 10:07:36 UTC
commit fbe2477fae40e546b31b8397d4ac79b5954c827b
Author: Tim-Philipp Müller <tim@centricular.com>
Date:   Thu Jun 26 14:09:25 2014 +0100

    bufferlist: pre-allocate buffer array in one go with the buffer list
    
    We can now create and free a buffer list with one slice alloc/free
    call in most cases, instead of one slice alloc/free for the list,
    one slice alloc/free for the GArray, and one malloc/free for the
    GArray array. In practice we know the max size of our buffer list
    from the start, so can avoid reallocs.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=732284