Results 1 to 6 of 6

Thread: The best way to read big file ??

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2009
    Posts
    12
    Qt products
    Qt4
    Platforms
    Windows
    Thanked 1 Time in 1 Post

    Default Re: The best way to read big file ??

    Hi,

    I read such files binary by using standard C++ streams. In order to improve speed i use my own stream buffer and reading in chunks (with buffer size). The interpretation of line ends can be done later directly on the buffer.
    Up to now i don't use multithreading. It makes only sense for me if you need some further interpretation (parsing) of the data.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: The best way to read big file ??

    You could experiement with QFile::map() to slide a window over the file, i.e. map a section of the file into memory, take whatever data you need, map the next section.

    Mapping a file or parts of a file into memory allows the operating system to coordinate file system buffers, optimize read/writes, avoid copying (from FS buffer to application memory), etc.

    Cheers,
    _

Similar Threads

  1. Read contents from the file using QHTTP Read()?
    By Gokulnathvc in forum Newbie
    Replies: 2
    Last Post: 21st June 2011, 08:03
  2. Read from a zip file
    By rajji_saini in forum Qt Programming
    Replies: 2
    Last Post: 21st June 2011, 00:28
  3. How to read a XML file that uses UTF-8?
    By PaladinKnight in forum Newbie
    Replies: 2
    Last Post: 10th April 2010, 13:52
  4. is qt phonon can read realmedia file and divx file
    By fayssalqt in forum Qt Programming
    Replies: 1
    Last Post: 27th January 2009, 15:42
  5. Replies: 1
    Last Post: 20th June 2008, 18:43

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.