Results 1 to 5 of 5

Thread: Why is QBuffer's close call so slow?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Why is QBuffer's close call so slow?

    It looks like close finishes immediately. It seems that it's the destructors that might be causing the slowdown. What is the point of using the buffer if you destroy it immediately afterwards without doing anything with the data saved in it? What happens if you move the buffer and byte array declarations outside the most inner scope?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  2. #2
    Join Date
    Apr 2009
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Why is QBuffer's close call so slow?

    What is the point of using the buffer if you destroy it immediately afterwards without doing anything with the data saved in it
    The section where it stands "//Process the stuff in the byteArray" is where I use the byteArray. I just ripped from this code sniplet that part out.

    What happens if you move the buffer and byte array declarations outside the most inner scope
    I haven't tried I'll see what happens..

  3. #3
    Join Date
    Apr 2009
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Why is QBuffer's close call so slow?

    After further investigation I found out that it is the deletion of "QXmlQuery query" that takes ages. Wysota's tip for moving declations outside the if clause gave me the hint that it could be some destruction (when leaving the if) that is taking such a long time. I moved (byteArray, buffer, sourceDocument and query) declarations to the beging of my method and changed the creation of "QXmlQuery query" to "QXmlQuery* query = new QXmlQuery();". I now see that

    Qt Code:
    1. //Starting to delete query "ROUTE" "ke 8. huhti 09:53:36 2009"
    2. if (query)
    3. delete query;
    4. //Finished deleting query "ROUTE" "ke 8. huhti 09:53:46 2009"
    To copy to clipboard, switch view to plain text mode 

    Any idea why deletion of QXmlQuery takes such a long time.

  4. #4
    Join Date
    Apr 2009
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Why is QBuffer's close call so slow?

    I also noticed that it does not help to move the QXmlQuery to class member and pass that to the method as a varaible. This way it would only need to be deleted once after all method calls. Anyway, this is because then QXmlQuery's

    "query->bindVariable("inputDocument", &sourceDocument);"

    will hold on the second method call. Most likely as to documentation "If name has already been bound, its previous binding will be overridden". So it is the realising of something that is slowing it down..

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.