« Return to Thread: Optimize jabber_id_new()

Re: Optimize jabber_id_new()

by datallah :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View in Thread

On Tue, Jun 30, 2009 at 4:31 AM, Mark Doliner<mark@...> wrote:
> The jabber_id_new() function in libpurple/protocols/jabber/jutil.c is
> pretty expensive.

<SNIP/>

> How do people feel about me checking this change into the jabber code
> in libpurple?  Meebo probably has a larger percentage of
> English-speaking users than Pidgin, so maybe our results are unfairly
> biased.  Does anyone know how common non-ASCII JIDs are?
>
> I suspect that even for the case where the jid contains non-ASCII
> characters our optimized version won't be very much slower, and might
> even be faster (it makes one pass over the string to determine the
> location of @ and / instead of calling g_utf8_strchr() twice (but
> that's easy to fix on its own)).
>
> In other words: How does everyone feel about the attached patch?

My (completely gut-based) guess is that non-ASCII JIDs are going to be
pretty uncommon "in the wild".  My impression is that even for
non-ASCII languages, people tend to use ASCII transliterations.
Perhaps Peter Saint-Andre can offer some more useful context-specific
insight .

I think the patch looks very reasonable - even in the case where it
ends up having to g_utf8_validate(), the new overhead appears to be
very minimal.

-D

_______________________________________________
Devel mailing list
Devel@...
http://pidgin.im/cgi-bin/mailman/listinfo/devel

 « Return to Thread: Optimize jabber_id_new()