[Bug 794173] New: filesink pointlessly uses write/writev

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Thu Mar 8 12:20:06 UTC 2018


https://bugzilla.gnome.org/show_bug.cgi?id=794173

            Bug ID: 794173
           Summary: filesink pointlessly uses write/writev
    Classification: Platform
           Product: GStreamer
           Version: git master
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: gstreamer (core)
          Assignee: gstreamer-bugs at lists.freedesktop.org
          Reporter: glippitsch at toolsonair.com
        QA Contact: gstreamer-bugs at lists.freedesktop.org
     GNOME version: ---

Created attachment 369437
  --> https://bugzilla.gnome.org/attachment.cgi?id=369437&action=edit
filesink: Change write function to fwrite()

filesink pointlessly uses write()/writev() system calls instead of the buffered
fwrite(). This effectively bypasses all buffering, and also withdraws any
effect of the buffer properties.

Attached patch uses fwrite() instead.

Performance gain is remarkable: Especially when writing small buffers to a
network storage, where the file is accessed by another machine at the same
time, writing speed can increase several hundred times.

I ran the following pipeline:
# gst-launch-1.0 fakesrc sizetype=2 sizemax=4 num-buffers=400000 ! filesink
location=testfile.raw

Current code:
Execution ended after 0:03:40.686780769

New patch:
Execution ended after 0:00:00.322147398

This is certainly an extreme case, but also on a local SSD, speed was between
1.5 and 2 times as fast.

With larger buffers, there is a minor increase in speed. I didn't find any case
where using fwrite() was significantly slower than the current code.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list