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 751122 - gsocket: avoid unnecessary g_socket_cond_wait() in _send_messages()
gsocket: avoid unnecessary g_socket_cond_wait() in _send_messages()
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: network
2.45.x
Other Linux
: Normal minor
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2015-06-17 16:30 UTC by Tim-Philipp Müller
Modified: 2015-06-21 09:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gsocket: avoid unnecessary g_socket_cond_wait() in _send_messages() (1.60 KB, patch)
2015-06-17 16:32 UTC, Tim-Philipp Müller
none Details | Review
gsocket: avoid unnecessary select in _send_messages() and _receive_message() (v2) (2.44 KB, patch)
2015-06-20 18:28 UTC, Tim-Philipp Müller
committed Details | Review

Description Tim-Philipp Müller 2015-06-17 16:30:47 UTC
For performance reasons we should always try to send our messages first and only wait for more space to become available if we get an EAGAIN (in blocking mode).
Comment 1 Tim-Philipp Müller 2015-06-17 16:32:58 UTC
Created attachment 305495 [details] [review]
gsocket: avoid unnecessary g_socket_cond_wait() in _send_messages()

For performance reasons we should always try to send our
messages first and only wait for more space to become
available if we get an EAGAIN (in blocking mode).
Comment 2 Dan Winship 2015-06-20 15:05:25 UTC
Comment on attachment 305495 [details] [review]
gsocket: avoid unnecessary g_socket_cond_wait() in _send_messages()

should fix g_socket_receive_message() too while we're here. Also, I assume you tested that "make check" still passes?
Comment 3 Tim-Philipp Müller 2015-06-20 18:28:18 UTC
Created attachment 305750 [details] [review]
gsocket: avoid unnecessary select in _send_messages() and _receive_message() (v2)

Thanks for the review! I did check the other functions, but clearly missed this one.

I did run 'make check' and it still passes for me (on Linux).

---

For performance reasons we should always try to send or
receive our messages first and only wait for more space
or data to become available if we get an EAGAIN (and
are in blocking mode).

v2: also do this in _receive_message()
Comment 4 Tim-Philipp Müller 2015-06-21 09:33:21 UTC
Pushed, thanks:

commit fd789f118741d89df348ba21ddc1d813da02fb76
Author: Tim-Philipp Müller <tim@centricular.com>
Date:   Wed Jun 3 13:06:24 2015 +0100

    gsocket: avoid unnecessary select in _send_messages() and _receive_message()
    
    For performance reasons we should always try to send or
    receive our messages first and only wait for more space
    or data to become available if we get an EAGAIN (and
    are in blocking mode).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=751122