On Thu, May 19, 2005 at 12:56:12PM -0500, phil wrote: > Why is it so slow? (RH Linux, 2.4.20, 1.6Ghz AMD) > 3/4 second slower to display widget w/unicode, > even if I encode u'\u221e'
u'\u221e' vs u'\N{INFINITY}' should make no noticible run-time difference--they both specify exactly the same string, and the decoding takes place at the time the script or module is byte-compiled. What Tk does at runtime is inspect a large number of fonts until it finds one with the desired character---or all the fonts, if the character doesn't exist. Querying all the fonts on your system can take quite a bit of time. I believe that Tk caches this information until program exit, or at least as long as the font is in use, and characters that are nearby in their unicode values will be resolved at the same time. I'm not aware of a good explanation of the low-level font handling in Tk; The information in the above paragraph was gleaned by reading the source code (tkUnixFont.c and tkWinFont.c). Jeff
pgpEsZ31qI4Yx.pgp
Description: PGP signature
-- http://mail.python.org/mailman/listinfo/python-list