IRC on-join sluggishness, profiled

Paul Aurich paul at darkrain42.org
Tue Jun 21 01:00:01 EDT 2011


And Paul Aurich spoke on 06/18/2011 08:18 PM, saying:
> I've attached one patch which greatly improves purple_conv_chat_cb_find's
> behavior (it's a significant pig), though we'd need to bump up to 2.9.0
> with this.

Based on Ethan's suggestion, I replaced that patch with a hash table in the
PurpleConvChat struct.

> The remaining big chunk of time is spent in this call chain:
> 	irc_msg_who
> 		purple_conv_chat_user_set_flags
> 			pidgin_conv_chat_update_user
> 		purple_conv_chat_cb_set_attributes
> 			pidgin_conv_chat_update_user
> 
> This is naturally called once for each user in the WHO, and there are a few
> issues with pidgin_conv_chat_update_user:
> 
> 1) It has an O(n) (n = size of list) search for the current row for the
> chat entry
> 
> 2) The search calls purple_utf8_strcasecmp, which, if I'm reading this
> kcachegrind output right (no guarantee of that), is over half of the cycles
> spent in pidgin_conv_chat_update_user.

With GtkTreeRowReference (thanks again, Ethan!), these are now O(1), and
quite nice.

Anyone who feels like it, please review these (I .  I'd like to pluck them
over to the im.pidgin.pidgin.2.9.0 branch tomorrow afternoon, so that IRC
is usable in large channels for the next release.

~Paul

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 900 bytes
Desc: OpenPGP digital signature
URL: <http://pidgin.im/pipermail/devel/attachments/20110620/2b68c347/attachment.sig>


More information about the Devel mailing list