Optimize jabber_id_new()
Jan Kaluza
hanzz.k at gmail.com
Wed Jul 1 00:54:29 EDT 2009
On Tue, Jun 30, 2009 at 5:28 PM, Daniel Atallah<daniel.atallah at gmail.com> wrote:
> On Tue, Jun 30, 2009 at 4:31 AM, Mark Doliner<mark at kingant.net> 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 .
In Czech Republic (our language uses non-ascii characters) people use
in almost 100% cases ascii JIDs, because they are used to do it
because of emails... So I agree with you :).
> 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 at pidgin.im
> http://pidgin.im/cgi-bin/mailman/listinfo/devel
>
Jan "HanzZ" Kaluza
More information about the Devel
mailing list