One problem with caching the result of calc_width is that in order to fix ticket #7 we can't assume that the width of a string will be the same from one call to the next.

Once we display a character on the user's terminal we might detect that their terminal doesn't display that character the way we expected, and we need to adjust that character's width in the library.
:(
(I didn't notice this ticket)

It doesn't make sense to cache if the number of cache hits are going to be significantly reduced by other optimizations.
of course

BTW, I am very interested in reproducing some of the Hachoir benchmarks. It would be great if someone would submit something like the bench_1.py program in contrib/trunk for Hachoir. Look at the bench_record.py program in contrib/trunk for an example of how to record some user input.
I use almost no code. I only added an option to hachoir-urwid to force a screen update between each event: http://hachoir.org/changeset/1532
(and a --profile option for the stats: http://hachoir.org/changeset/1525)
I record a test with:
$ tee events | hachoir-urwid file.ext
and bench with:
$ hachoir-urwid --profiler --profile-display file.ext < events

JM



_______________________________________________
Urwid mailing list
[email protected]
http://lists.excess.org/mailman/listinfo/urwid

Reply via email to