[Urwid] Re: Unbearable slowness in UTF-8 mode

Nuutti Kotivuori naked at iki.fi
Sat Oct 14 10:09:09 EDT 2006


Ian Ward wrote:
> Nuutti Kotivuori wrote:
>> Thanks! I tried the patch and it alleviates the situation a
>> lot. However, performance is still not good enough. Here is a sample
>> program to check the performance (not minimal, one of my test files):
>>
> ...
>> When run in ISO-8859-1 mode, performance is great - when run in UTF-8
>> mode, even with the patch, I can easily max out the CPU and have the
>> display updating really slow by rapidly tapping left and right.
>
> I've updated the patch.  Give this version a try and let me know.

This updated version works like a charm! The CPU usage when switching
columns is mostly identical with ISO-8859-1 and UTF-8. I tried a
couple other test programs as well and the speed is great there as
well. The difference is also noted when running the graph example from
urwid distribution - it works nice and smooth with a large terminal
now.

There is only one case where I could get a noticeable slowdown - and
that was an edit field where I wrote around 20 lines of the japanese
character 'a'. After that, every keypress took like a second to be
processed. But the only thing alleviating that would be to actually
make the calc_width calculation fast somehow. Pyrex or calling the
system wcwidth or something.

Anyway, thanks a lot for the fixes - I will be mailing more stuff here
as it comes up.

-- Naked






More information about the Urwid mailing list