[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[be] [task #9084] Reduce bibledit-bin's cpu usage
From: |
Teus Benschop |
Subject: |
[be] [task #9084] Reduce bibledit-bin's cpu usage |
Date: |
Mon, 02 Feb 2009 14:57:25 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.3) Gecko/2008092816 Iceweasel/3.0.3 (Debian-3.0.3-3) |
URL:
<http://savannah.nongnu.org/task/?9084>
Summary: Reduce bibledit-bin's cpu usage
Project: Bibledit
Submitted by: teus
Submitted on: Mon 02 Feb 2009 04:57:22 PM CAT
Should Start On: Mon 02 Feb 2009 12:00:00 AM CAT
Should be Finished on: Mon 02 Feb 2009 12:00:00 AM CAT
Priority: 5 - Normal
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
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 to this item at:
<http://savannah.nongnu.org/task/?9084>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/
- [be] [task #9084] Reduce bibledit-bin's cpu usage,
Teus Benschop <=