Thanks for the nice patch, seems to work well. cu Christoph Cullmann Am Mittwoch, 28. Februar 2001 14:46 schrieb Martin Schenk: > The last big performance problem in kwrite is the use of > QFontMetrics::width to calculate the width of characters. > > I implemented a class CachedFontMetrics, inheriting from > QFontMetrics, that caches the width of characters. > > For memory efficiency, this class allocates memory by > Unicode-Row (256 characters) - ASCII text only needs > row 0, so only that is allocated. When using other character > sets, the needed rows are dynamically allocated. > > Using this class, changing the font from "courier new" > to "arial" on 800K text takes less than 1 second, compared > to about 10 seconds the old way. As this example shows, > this speedup also works with proportional fonts, in contrast > to the (currently unused) Attribute::width speedup. ---------------------------------------- Content-Type: text/x-c; charset="iso-8859-1"; name="kwattribute.h" Content-Transfer-Encoding: base64 Content-Description: includes implementation of CachedFontMetrics ---------------------------------------- ---------------------------------------- Content-Type: text/x-c; charset="iso-8859-1"; name="kwattribute.cpp" Content-Transfer-Encoding: base64 Content-Description: uses CachedFontMetrics ---------------------------------------- >> Visit http://master.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<