Or is it?

Behdad

Optimizing really tiny things is hard, and maybe my initial feeling was correct in that this cannot be optimized. However, I ran Behdad’s test on my computer, and it came out as above. This is the exact same test on the dataset that federico provided (however, I profiled only the original and Behdad’s code, as that should be sufficient to demonstrate any differences between his test setup and mine). It still shows a significant gain, especially for latin-1 languages.

I compiled the test with -g -O2, as is necessary to see the benefits of optimized C code. Behdad: I don’t know which flags you used. If we’re using the same compiler flags, the difference must be down to the fact that I’m testing on an Athlon and you’re on a P4. That would be pretty amusing.

Oh, and a profile of a GtkTextIter test case that I got from Larry the other day had g_utf8_offset_to_pointer() show up as using 50% of the CPU time. I don’t know if it’s a realistic case, though. At least we’re learning about optimization in the context of distributed efforts. Or something.

Leave a Reply

Please copy the string Ysu0Pk to the field below: