bibledit-development
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[be] bibledit-bin CPU usage


From: Dan Dennison
Subject: [be] bibledit-bin CPU usage
Date: Sat, 31 Jan 2009 16:47:25 -0800

I ran bibledit-bin on Linux through callgrind, which is part of valgrind.

It seems the bulk of its idle CPU usage is in the following fragment, located in editor_aids.cpp:

  for (unsigned int i = 0; i < usfm->styles.size(); i++) {
    if (marker == usfm->styles[i].marker) {
      type = usfm->styles[i].type;
      subtype = usfm->styles[i].subtype;
      break;
    }
  }

This fragment is called every verse_tracker_timeout. Of the 51 verse_tracker_timeouts captured by my sample, 43,880 calls were made to ustring::compare, which is called during evaluation of the if statement. Quick math shows about 860 calls to a string comparison per verse_tracker_timeout.

I think I might be possible to optimize the loop out completely by using a hash table to do the lookup here. This is significant because the idle CPU draw from bibledit-bin can be then further reduced, allowing for even greater laptop battery life, crucial for some of our deployment scenarios.

What do you think? My callgrind output is at https://thedennisons.org/ ~dand/callgrind.out.19357.gz

dan :)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]