Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-37092

QUdpSocket: Different behaviour of writeDatagram between QT5.1 and QT4.8. Slower with new version.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.4.0
    • 5.1.1
    • Network: Sockets
    • None
    • GNU/Linux Emdebian Wheezy Grip with armhf architecture
    • 1910454fe00cce8b815b1abc0a18a04d3d387ccf

    Description

      I am facing an unusual behaviour related to the performance of the method writeDatagram of QUdpSocket using two different version of QT ( Qt4.8.5 vs Qt5.1.1).

      I tested the same program both on Ubuntu between 4.8.1 and 5.0 and the results are fine.
      While on an emDebian arm platform, Qt5.1.1 performs much worse than Qt4.8.5 (two order of magnitude times slower).

      My application is just calling writeDatagram in a for loop and returns the average time writeDatagram calls.
      The results after 10000 calls, sending 19bytes of payload are:
      Qt 4.8.5 avg 0.000224s each call
      Qt 5.1.1 avg 0.033..s (about 30ms each message).

      I checked in Wireshark and I am able to receive the messages in both cases.
      Moreover, I tested vanilla c socket and they perform as good as qt 4.8.5.
      I looked a bit in the qt code and saw a bind() inside the QT5 writeDatagram method, which I do not immediately understand but I do not know if might cause the issue.

      Here the output when I use strace:
      (The output while in the for loop)

      QT4.8.5

      sendto(7, "Broadcast message 0", 19, MSG_NOSIGNAL, {sa_family=AF_INET, sin_port=htons(45454), sin_addr=inet_addr("255.255.255.255")}, 16) = 19
      sendto(7, "Broadcast message 0", 19, MSG_NOSIGNAL, {sa_family=AF_INET, sin_port=htons(45454), sin_addr=inet_addr("255.255.255.255")}, 16) = 19
      sendto(7, "Broadcast message 0", 19, MSG_NOSIGNAL, {sa_family=AF_INET, sin_port=htons(45454), sin_addr=inet_addr("255.255.255.255")}, 16) = 19
      sendto(7, "Broadcast message 0", 19, MSG_NOSIGNAL, {sa_family=AF_INET, sin_port=htons(45454), sin_addr=inet_addr("255.255.255.255")}, 16) = 19
      sendto(7, "Broadcast message 0", 19, MSG_NOSIGNAL, {sa_family=AF_INET, sin_port=htons(45454), sin_addr=inet_addr("255.255.255.255")}, 16) = 19
      sendto(7, "Broadcast message 0", 19, MSG_NOSIGNAL, {sa_family=AF_INET, sin_port=htons(45454), sin_addr=inet_addr("255.255.255.255")}, 16) = 19
      sendto(7, "Broadcast message 0", 19, MSG_NOSIGNAL, {sa_family=AF_INET, sin_port=htons(45454), sin_addr=inet_addr("255.255.255.255")}, 16) = 19
      sendto(7, "Broadcast message 0", 19, MSG_NOSIGNAL, {sa_family=AF_INET, sin_port=htons(45454), sin_addr=inet_addr("255.255.255.255")}, 16) = 19
      sendto(7, "Broadcast message 0", 19, MSG_NOSIGNAL, {sa_family=AF_INET, sin_port=htons(45454), sin_addr=inet_addr("255.255.255.255")}, 16) = 19
      sendto(7, "Broadcast message 0", 19, MSG_NOSIGNAL, {sa_family=AF_INET, sin_port=htons(45454), sin_addr=inet_addr("255.255.255.255")}, 16) = 19
      sendto(7, "Broadcast message 0", 19, MSG_NOSIGNAL, {sa_family=AF_INET, sin_port=htons(45454), sin_addr=inet_addr("255.255.255.255")}, 16) = 19
      

      QT 5.1.1

      sendto(6, "Broadcast message 0", 19, MSG_NOSIGNAL, {sa_family=AF_INET6, sin6_port=htons(45454), inet_pton(AF_INET6, "::ffff:255.255.255.255", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 19
      socket(PF_FILE, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 7
      ioctl(7, SIOCGIFINDEX, {ifr_name="", ???}) = -1 ENODEV (No such device)
      close(7)                                = 0
      sendto(6, "Broadcast message 0", 19, MSG_NOSIGNAL, {sa_family=AF_INET6, sin6_port=htons(45454), inet_pton(AF_INET6, "::ffff:255.255.255.255", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 19
      socket(PF_FILE, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 7
      ioctl(7, SIOCGIFINDEX, {ifr_name="", ???}) = -1 ENODEV (No such device)
      close(7)                                = 0
      sendto(6, "Broadcast message 0", 19, MSG_NOSIGNAL, {sa_family=AF_INET6, sin6_port=htons(45454), inet_pton(AF_INET6, "::ffff:255.255.255.255", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 19
      socket(PF_FILE, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 7
      ioctl(7, SIOCGIFINDEX, {ifr_name="", ???}) = -1 ENODEV (No such device)
      close(7)                                = 0
      sendto(6, "Broadcast message 0", 19, MSG_NOSIGNAL, {sa_family=AF_INET6, sin6_port=htons(45454), inet_pton(AF_INET6, "::ffff:255.255.255.255", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 19
      socket(PF_FILE, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 7
      ioctl(7, SIOCGIFINDEX, {ifr_name="", ???}) = -1 ENODEV (No such device)
      close(7)                                = 0
      sendto(6, "Broadcast message 0", 19, MSG_NOSIGNAL, {sa_family=AF_INET6, sin6_port=htons(45454), inet_pton(AF_INET6, "::ffff:255.255.255.255", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 19
      socket(PF_FILE, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 7
      ioctl(7, SIOCGIFINDEX, {ifr_name="", ???}) = -1 ENODEV (No such device)
      close(7)                                = 0
      

      This bug was already posted in QT forum:
      https://qt-project.org/forums/viewthread/38876/
      and in the mailing-list with the subject "Performance of QUdpSocket writeDatagram between Qt4 and Qt5 in different GNU/Linux platforms"

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            peter-har Peter Hartmann
            malloblenne Mauro Brenna
            Votes:
            6 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes