Optimization army
[Nice song mentioned by
Havoc.:
Brownsville Girl]
Tomorrow
Billy is coming here to UBZ, so we can clean up Pango patches and (if federico and mclasen are around), commit them. Looking forward for a hard-working day with him.
Amazing to see so many people have responded (on
planet and
list) to
Federico's call for optimization on g_utf8_offset_to_pointer
. Apparently many people are (really) ready to help, should you give them a concrete problem at hand. And from
my own experience and this case,
Planet GNOME is a much better place to dispatch such tasks than any mailing list. It just triggers so many random readers that never get your message on the mailing lists.
As for the offset_to_pointer problem, I don't quite agree with
Morten. Of course, if there are invocations of this function in a loop, that causes square time and should be changed, but I believe this function can still show up in benchmarks from being called so many
constant times. Not sure this is the case in the original backtrace that exposed the problem though.
Anyway, I like
Luis Menina's approach of simply going over all bytes and counting how many have the two high bits not equal to 10.
hpj's approach of handling a 32-bit word at a time is interesting too, but (much) more complex. Mixing the two, I have some ideas about it. We will see tomorrow.