Performance issues with u_snprintf_u from libicu

94 Views Asked by At

I'm porting some application from wchar_t for C strings to char16_t offered by C++11.

Although I have an issue. The only library I found that can handle snprintf for char16_t types is ICU with their UChar types.

The performance of u_snprintf_u (equivalent to swprintf/snprintf, but taking Uchar as arguments) is abismal.

Some testing leads to u_snprintf_u being 25x slower than snprintf.

Example of what I get on valgrind :

callgrind

As you can see, the underlying code is doing too much work and instanciating internal objects that I don't want.

Edit : The data I'm working with doesn't need to be interpreted by the underlying ICU code. It's ascii oriented. I didn't find any way to tell ICU to not try to apply locales and such on such function calls.

0

There are 0 best solutions below