×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    Tunisia
    Posts
    81

    Question Performance considerations on flushing a file stream

    Hi,
    My app download files from the web to the devices, but in Symbian Belle Refresh devices (witch have Qt 4.8 preinstalled, like Nokia N8, C7, X7...) my app lags so much when downloading files, there is a description about this issue and the workaround here: Performance considerations on flushing a file stream
    But I have no idea how to apply this workaround in downloading files from the web.

    To download files I'm using these functions/slots:

    Code:
    QFile file;
    QNetworkAccessManager *nam;
    QNetworkReply *downloadReply;
    
    //function
    void DownloaderClass::performDownload(const QUrl &fileUrl) {
        QNetworkRequest request(fileUrl);
        downloadReply = nam->get(request);
        connect(downloadReply, SIGNAL(readyRead()), this, SLOT(downloadReadyRead()));
    }
    
    //SLOT
    void DownloaderClass::downloadReadyRead() {
        file.write(downloadReply->readAll());
    }
    This method causes a huge lags when downloading a file in Symbian Belle Refresh Devices, please someone can help me with a solution?
    Thanks
    Last edited by aymen_ka; 2013-12-04 at 21:10. Reason: Link did not work with the ticked id inside

  2. #2
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,359

    Re: Performance considerations on flushing a file stream

    So you suspect that write is flush-ing the buffers?
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  3. #3
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    Tunisia
    Posts
    81

    Re: Performance considerations on flushing a file stream

    Quote Originally Posted by ltomuta View Post
    So you suspect that write is flush-ing the buffers?
    Thanks for your response
    Yes, because ma app lag only when downloading files, after the download is finished my app become smooth. Also, this issue appear only in devices with Qt 4.8 (Symbian Belle Refresh), in the devices with older firmware that have Qt 4.7.4 there is no lag when downloading files.

  4. #4
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    685

    Re: Performance considerations on flushing a file stream

    Are you trying to do that on the UI thread or in a background thread?
    and btw your code doesnt show where you flush the file.... maybe you should post a more precise and bigger code sample.
    Heard of DVLUP? Join here

  5. #5
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    Tunisia
    Posts
    81

    Re: Performance considerations on flushing a file stream

    Quote Originally Posted by shai.i View Post
    Are you trying to do that on the UI thread or in a background thread?
    and btw your code doesnt show where you flush the file.... maybe you should post a more precise and bigger code sample.
    I'm doing this in background thread but I show the progress of the download in UI (QML).
    When downloading a relatively big files (some Mb), it will written progressively to the file, every some bytes received from the web the signal readyRead() is emitted and the downloadReadyRead() slot is called to append these bytes to the file until the files is downloaded completely.
    For example, to download a few megabytes file size, the is many hundreds of calls of the downloadReadyRead() SLOT, because every amount of bytes received a signal is emitted to call this slot and append these bytes to the file (flush the file).

Similar Threads

  1. Replies: 3
    Last Post: 2007-11-17, 10:31
  2. Modem Legal Considerations
    By impconfemo in forum General Development Questions
    Replies: 0
    Last Post: 2004-05-13, 00:55
  3. Modem Legal Considerations
    By impconfemo in forum Digital Rights Management & Content Downloading
    Replies: 0
    Last Post: 2004-05-13, 00:53
  4. Flushing the Memory
    By varunmsvp in forum PC Suite API and PC Connectivity SDK
    Replies: 1
    Last Post: 2003-02-23, 10:27

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×