Re: [PATCH] speed up Qt resize

2002-12-10 Thread John Levon
On Tue, Dec 10, 2002 at 08:36:45PM +0200, Dekel Tsur wrote: > Another idea is to just cache the width for the default text font. This would reduce the speedup we get... regards john -- "Saying that taste is just personal preference is a good way to prevent disputes. The trouble is, it's not tr

Re: [PATCH] speed up Qt resize

2002-12-10 Thread Dekel Tsur
On Tue, Dec 10, 2002 at 06:10:46PM +, John Levon wrote: > > One solution (other than cleaning the cache) is to store > > (qfont_loader::font_info const *, int) pairs instead of > > (LyXFont, int) pairs. > > I'm going to do something similar indeed. Another idea is to just cache the width for

Re: [PATCH] speed up Qt resize

2002-12-10 Thread John Levon
On Tue, Dec 10, 2002 at 11:48:59AM +0100, Lars Gullik Bjønnes wrote: > I have a feeling that the cache is a bit more complex than it needs to > be, but I cannot quite put my finger on it... I'm going to rework things a bit I think > How often is metrics for whole strings wanted? Not often. the

Re: [PATCH] speed up Qt resize

2002-12-10 Thread John Levon
On Tue, Dec 10, 2002 at 11:57:08AM +0200, Dekel Tsur wrote: > What happens when the user changes the font in the preferences dialog ? > If I'm not mistaken, the cache will not be cleared. Yes it will. Like I mentioned ... > One solution (other than cleaning the cache) is to store > (qfont_loade

Re: [PATCH] speed up Qt resize

2002-12-10 Thread Lars Gullik Bjønnes
John Levon <[EMAIL PROTECTED]> writes: What is the used for? | +typedef pair MetricPair; | +typedef vector MetricList; | +typedef map CharMetrics; | +CharMetrics char_metrics; | + | +int singlewidth(Uchar val, LyXFont const & f) | +{ | + CharMetrics::iterator it(char_metrics.find(val)); |

Re: [PATCH] speed up Qt resize

2002-12-10 Thread Lars Gullik Bjønnes
John Levon <[EMAIL PROTECTED]> writes: | On Tue, Dec 10, 2002 at 12:41:26AM +, John Levon wrote: | | > Well I'm out of ideas so here's a dumb patch that caches single widths. | | btw, a map based approach is at least twice as slower than | the vector one below | | > resize took 1.64121 seco

Re: [PATCH] speed up Qt resize

2002-12-10 Thread Dekel Tsur
On Tue, Dec 10, 2002 at 03:01:36AM +, John Levon wrote: > > Unless somebody has major complaints I'm going to commit it ... What happens when the user changes the font in the preferences dialog ? If I'm not mistaken, the cache will not be cleared. One solution (other than cleaning the cache)

Re: [PATCH] speed up Qt resize

2002-12-09 Thread Andre Poenitz
On Tue, Dec 10, 2002 at 12:41:26AM +, John Levon wrote: > int ascent(char c, LyXFont const & f) > { > - QRect r = metrics(f).boundingRect(c); > + QRect const & r = metrics(f).boundingRect(c); > return -r.top(); > } Why not return -metrics(f).boundingRect(c).top(); Andre'

Re: [PATCH] speed up Qt resize

2002-12-09 Thread John Levon
On Tue, Dec 10, 2002 at 12:41:26AM +, John Levon wrote: > Well I'm out of ideas so here's a dumb patch that caches single widths. btw, a map based approach is at least twice as slower than the vector one below > resize took 1.64121 seconds > resize took 1.18429 seconds > resize took 1.3532 s