Results 1 to 8 of 8

Thread: QVector or Database

  1. #1
    Join Date
    Aug 2007
    Posts
    275
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    28
    Thanked 2 Times in 2 Posts

    Default QVector or Database

    Guys,

    I have an app that is trying to decompress a datafile and plots the data and its really slow

    heres the given:
    compress file is about 100MB size this about 130 000 records.....
    uncompress file would be about 400MB
    my plotter can browse to all the uncompress file 200 (maximum records at a time)

    heres what i did
    decompess input file then save in a vector of records (QVector)
    connect my plotter using an index in the vector (this is vey slow)

    I guess my other option is to use a database, I uncompress all data and save it all into the database then connect my plotter, do you think this will improve my speed in browsing?

    is there any other good way of handling this stress of my life?

    baray98

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: QVector or Database

    What kind of data do you have? What do you mean exactly by "browsing"?

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

    Default Re: QVector or Database

    No, I don't think using a database will cause any speed improvement.

    You need to find the bottleneck in your application and think how to remove it. You should certainly implement some caching. QGraphicsView is a good candidate for a replacement.

  4. #4
    Join Date
    Aug 2007
    Posts
    275
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    28
    Thanked 2 Times in 2 Posts

    Default Re: QVector or Database

    I implemented my browsing mechanism as below:

    vector of records as source (vectorRec),
    input from user starting records (startRec)
    input from user number of records to show from starting records (recToShow)

    i have a loop like this

    Qt Code:
    1. for (int i = 0 ; i < recToShow ; i++)
    2. {
    3. record = vectorRec.at(i+startRec); // get a record
    4. record.decompress
    5. plotData(record);
    6. }
    To copy to clipboard, switch view to plain text mode 

    I noticed that if my vector has lesser count say 30 000 records, I browse faster than i have 60 000 records ofcourse i kept my number of records to show constant at this tests.

    It seems that the bottleneck would be the retrieving of records from my vectors, now if i have to implement some simple caching , i might just split up the records into vectors of 10 000 what do you think guys? will it help if i will split it up.

    baray98

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

    Default Re: QVector or Database

    Quote Originally Posted by baray98 View Post
    It seems that the bottleneck would be the retrieving of records from my vectors
    Don't guess. Check it using a profiler.

  6. #6
    Join Date
    Aug 2007
    Posts
    275
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    28
    Thanked 2 Times in 2 Posts

    Default Re: QVector or Database

    i tried using gprof i am very new to this profiler stuff and i got the "undefined refrence mcount" problem and i was stuck i dont know how to compile it with profiler on

    here is what i did

    since i am using gnu i added -pg option on the CXXFLAGS in my make file is there some more settings that i missed? Or how can i get rid of the mcount problem?

    baray98

  7. #7
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: QVector or Database

    Wiki: [wiki]Profiling[/wiki]
    Last edited by wysota; 9th December 2007 at 10:33. Reason: Changed [url] tags to the new [wiki] ones :)
    J-P Nurmi

  8. #8
    Join Date
    Jan 2006
    Location
    Socorro, NM, USA
    Posts
    29
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11
    Thanked 3 Times in 3 Posts

    Default Re: QVector or Database

    Quote Originally Posted by baray98 View Post
    I noticed that if my vector has lesser count say 30 000 records, I browse faster than i have 60 000 records ofcourse i kept my number of records to show constant at this tests.

    It seems that the bottleneck would be the retrieving of records from my vectors, now if i have to implement some simple caching , i might just split up the records into vectors of 10 000 what do you think guys? will it help if i will split it up.

    baray98
    A shot in the dark: I would think that you have a memory problem. Please check what the amount of data you want to cache is. If it is more than the amount of physisal memory in your computer, the OS will probably start swapping out inactive pages which can take a noticeable amount of time.
    There are 10 people in the world. Those who understand binary and those who don't.

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.