Results 1 to 3 of 3

Thread: scan Freeze map slow

  1. #1
    rolandsun is offline Registered User
    Name: roland sun
    Organization: metstar
    Project: weather radar product generation software
    Join Date
    Sep 2008
    Location
    beijing
    Posts
    9

    scan Freeze map slow

    we define map key as
    Code:
    struct bufKey {
        int stime;
        int etime;
        short angle;
       short datatype;
       string code;
       string name; 
    }
    while data is another complex structure, which is about 300k per record.
    we use simple code to scan database when program startup as
    Code:
     Basedb::const_iterator it;
     for(it=baseDatabase.begin();it!=baseDatabase.end();it++)
    {
           printf("time %d\n",it->first.stime);
    }
    We use BDB as database.The scan become very slow (several minutes) when the size of database grow more than 1GB. I add Freeze.Trace.Map config file and found that "duplicating iterator/close iterator" uses most of the time.

    Can I speed up the scan ?

  2. #2
    bernard's Avatar
    bernard is online now ZeroC Staff
    Name: Bernard Normier
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Palm Beach Gardens, FL
    Posts
    1,294
    Hi Roland,

    You should switch to a prefix increment (++it), that does not create a temporary copy of the iterator.

    Then, if baseDatabase is not const, you should use a const variable to avoid the conversion from iterator to const_iterator in it != baseDatabase.end().

    Overall:
    Code:
    const Basedb& baseDatabaseConst = baseDatabase;
    for(Basedb::const_iterator it = baseDatabaseConst.begin(); it != baseDatabaseConst.end(); ++it)
    {
           printf("time %d\n", it->first.stime);
    }
    Let us know how it goes.

    Also, please update your profile: 'proof of concept' is not an acceptable project.

    Best regards,
    Bernard
    Bernard Normier
    ZeroC, Inc.

  3. #3
    rolandsun is offline Registered User
    Name: roland sun
    Organization: metstar
    Project: weather radar product generation software
    Join Date
    Sep 2008
    Location
    beijing
    Posts
    9
    Hi Bernard ,

    I tried what you told me ,while I got almost no improvement . Actually what I want is only to scan the keys , I think Freeze read both key and data into memory , so it take long time.

    I have to scan the database by BDB api if there is no better solution.
    Last edited by rolandsun; 11-25-2011 at 12:08 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. the freeze Evictor map
    By wdp221651 in forum Help Center
    Replies: 1
    Last Post: 08-28-2008, 07:41 AM
  2. Freeze::ConnectionPtr from Freeze::Map Obj
    By paolo in forum Comments
    Replies: 1
    Last Post: 01-05-2008, 05:02 PM
  3. getting normal map from freeze map
    By ctennis in forum Help Center
    Replies: 2
    Last Post: 03-09-2007, 07:48 AM
  4. Slow in Freeze Evictor add operation
    By Yunqiao Yin in forum Help Center
    Replies: 2
    Last Post: 02-06-2007, 07:38 PM
  5. Freeze Map doubt
    By pradeep in forum Help Center
    Replies: 1
    Last Post: 11-30-2006, 09:28 AM

Tags for this Thread

Posting Permissions

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