[Pidgin] #4816: ocar protocol performance improvement(s)

Pidgin trac at pidgin.im
Sat Feb 9 11:36:34 EST 2008


#4816: ocar protocol performance improvement(s)
-------------------+--------------------------------------------------------
Reporter:  oliver  |       Owner:  MarkDoliner            
    Type:  patch   |      Status:  new                    
Priority:  minor   |   Component:  AIM                    
 Version:  2.3.1   |    Keywords:  oscar performance patch
 Pending:  0       |  
-------------------+--------------------------------------------------------
 oscar.c:6581 oscar_normalize() does a string copy (line 6589) but the
 following loop effectively moves each byte (skipping the blanks). I think
 we can use only the loop to copy the string and remove the (expensive)
 call to strncpy(). vallgrind/callgrind says that the strncpy() call is
 responsible for more than half the time spent in this function and of all
 the liboscar function it is one of the most often called. See attached
 patch.[[BR]]

 Which brings me to the next bottleneck/performance problem.[[BR]]

 Lot's of time is spend in aim_sncmp() (util.c 232) because (a) the
 function is kind of expensive and (b) it's called a lot. I think the big
 rblem here is that all the aim_ssi_itemlist_* functions are littered with
 linear searches that call the compare function in the loop
 (family_feedbag.c:309 and family_feedbag.c:352).[[BR]]

 It might be worth to sacrifice a few extra bytes of memory and either (i)
 store the uppercase&normalized version of the name and keep the linear
 search or (ii) use a hashmap to lookup the name, effectively getting rid
 of the linear searches.[[BR]]

 This is a bigger change, I'll look into that but comments are welcome.

-- 
Ticket URL: <http://developer.pidgin.im/ticket/4816>
Pidgin <http://pidgin.im>
Pidgin


More information about the Tracker mailing list