Profile: LyX/Mac 1.5.0svn Qt-4.1.3 -- Typing

2006-05-25 Thread Bennett Helm
This profile was generated by simply typing into the middle of a  
large document for 30 seconds.


Bennett


# Report 0 - Session 1 - Time Profile of lyx
SharkProfileViewer
# Generated from the visible portion of the outline view
+ 24852.6 ms main (lyx)
| + 24852.6 ms LyX::priv_exec(int&, char**) (lyx)
| | + 24852.6 ms lyx_gui::start(std::basic_stringstd::char_traits, std::allocator > const&,  
std::vector,  
std::allocator >, std::allocatorstd::char_traits, std::allocator > > > const&) (lyx)

| | | - 88.2 ms QWorkArea::paintEvent(QPaintEvent*) (lyx)
| | | + 24307.2 ms QWorkArea::keyPressEvent(QKeyEvent*) (lyx)
| | | | + 24305.1 ms BufferView::workAreaKeyPress 
(boost::shared_ptr, key_modifier::state) (lyx)
| | | | | + 24305.1 ms BufferView::Pimpl::workAreaKeyPress 
(boost::shared_ptr, key_modifier::state) (lyx)
| | | | | | + 24126.9 ms LyXFunc::processKeySym 
(boost::shared_ptr, key_modifier::state) (lyx)

| | | | | | | + 24116.6 ms LyXFunc::dispatch(FuncRequest const&) (lyx)
| | | | | | | | - 32.9 ms Buffer::buildMacros() (lyx)
| | | | | | | | - 4.1 ms BufferView::Pimpl::metrics(bool) (lyx)
| | | | | | | |   1.0 ms CoordCache::CoordCache[in-charge]() (lyx)
| | | | | | | |   1.0 ms LyXView::updateLayoutChoice() (lyx)
| | | | | | | |   1.0 ms Buffer::params() (lyx)
| | | | | | | | + 14263.5 ms BufferView::Pimpl::update(Update::flags)  
(lyx)

| | | | | | | | | + 13600.6 ms BufferView::Pimpl::metrics(bool) (lyx)
| | | | | | | | | | + 13598.5 ms LyXText::redoParagraph(int) (lyx)
| | | | | | | | | | | + 6849.9 ms LyXText::rowBreakPoint(int, Row&)  
const (lyx)
| | | | | | | | | | | | + 6371.2 ms font_metrics::width(char, LyXFont  
const&) (lyx)

| | | | | | | | | | | | |   1.0 ms LaTeX::deplog(DepTable&) (lyx)
| | | | | | | | | | | | | - 10.1 ms font_metrics::width(char const*,  
unsigned long, LyXFont const&) (lyx)
| | | | | | | | | | | | - 54.7 ms font_metrics::width(char const*,  
unsigned long, LyXFont const&) (lyx)

| | | | | | | | | | | | - 36.5 ms Paragraph::isNewline(int) const (lyx)
| | | | | | | | | | | |   11.1 ms LyXText::singleWidth(Paragraph  
const&, int, char, LyXFont const&) const (lyx)
| | | | | | | | | | | | - 135.4 ms LyXText::leftMargin(int, int)  
const (lyx)
| | | | | | | | | | | | - 9.1 ms Paragraph::isLineSeparator(int)  
const (lyx)

| | | | | | | | | | | | - 19.2 ms FontIterator::operator++() (lyx)
| | | | | | | | | | | | - 19.2 ms Paragraph::isInset(int) const (lyx)
| | | | | | | | | | | |   3.1 ms QLFontInfo::width(unsigned short)  
const (lyx)

| | | | | | | | | | | |   3.0 ms Paragraph::getChar(int) const (lyx)
| | | | | | | | | | | |   1.0 ms LyXTextClassList::operator[] 
(unsigned long) const (lyx)
| | | | | | | | | | | |   1.0 ms LyXText::rightMargin(Paragraph  
const&) const (lyx)
| | | | | | | | | | | | - 5.1 ms FontIterator::FontIterator[in-charge] 
(LyXText const&, Paragraph const&, int) (lyx)
| | | | | | | | | | | | - 1.0 ms RandomAccessList::operator 
[](unsigned long) const (lyx)
| | | | | | | | | | | + 6490.8 ms LyXText::setRowWidth(int, Row&)  
const (lyx)
| | | | | | | | | | | | + 6117.2 ms font_metrics::width(char, LyXFont  
const&) (lyx)
| | | | | | | | | | | | | + 9.1 ms font_metrics::width(char const*,  
unsigned long, LyXFont const&) (lyx)
| | | | | | | | | | | | | | - 6.1 ms LyXTextClassList::operator[] 
(unsigned long) const (lyx)
| | | | | | | | | | | | | | - 2.0 ms font_metrics::signedWidth 
(std::basic_string, std::allocator  
> const&, LyXFont const&) (lyx)
| | | | | | | | | | | | | | - 1.0 ms FontLoader::fontinfo(LyXFont  
const&) (lyx)
| | | | | | | | | | | | - 53.6 ms font_metrics::width(char const*,  
unsigned long, LyXFont const&) (lyx)
| | | | | | | | | | | | - 130.7 ms LyXText::leftMargin(int, int)  
const (lyx)

| | | | | | | | | | | | - 19.2 ms FontIterator::operator++() (lyx)
| | | | | | | | | | | | - 12.2 ms Paragraph::getChar(int) const (lyx)
| | | | | | | | | | | | - 8.1 ms LyXText::singleWidth(Paragraph  
const&, int, char, LyXFont const&) const (lyx)
| | | | | | | | | | | | - 14.2 ms LyXText::rightMargin(Paragraph  
const&) const (lyx)
| | | | | | | | | | | |   1.0 ms QLFontInfo::width(unsigned short)  
const (lyx)
| | | | | | | | | | | | - 6.1 ms FontIterator::FontIterator[in-charge] 
(LyXText const&, Paragraph const&, int) (lyx)
| | | | | | | | | | |   19.2 ms font_metrics::width(char, LyXFont  
const&) (lyx)
| | | | | | | | | | | - 147.0 ms LyXText::setHeightOfRow(int, Row&)  
(lyx)
| | | | | | | | | | |   2.0 ms std::vector  
>::push_back(Row const&) (lyx)

| | | | | | | | | | | - 2.0 ms Paragraph::isNewline(int) const (lyx)
| | | | | | | | | | |   1.0 ms std::vector  
>::clear() (lyx)
| | | | | | | | | | | - 24.4 ms LyXText::leftMargin(int, int) const  
(lyx)
| | | | | | | | | | | - 19.4 ms InsetFootlike::metrics(MetricsInfo&,  
Dimension&) const (lyx)
| | | | | | | | | | | - 17.3 ms InsetSpecialChar::metrics 
(MetricsInfo&, Dimension&) const (lyx)
| | | | | | | | | | | - 15.3 ms InsetQuotes::metrics(MetricsInfo&,  
Dimension&) const 

Re: Profile: LyX/Mac 1.5.0svn Qt-4.1.3 -- Typing

2006-05-25 Thread Abdelrazak Younes

Bennett Helm wrote:
This profile was generated by simply typing into the middle of a large 
document for 30 seconds.


I see that there is a lot of improvement compared to your former profile 
WRT qt4 frontends. Do you feel the improve in speed?
AFAICS the clear culprit is again font_metrics::width(). This is true 
for your first three patches (typing and scrolling with down keys). But 
I really don't understand where the time is spent inside this method (it 
is not shown in the deeper profile results):


 + 6371.2 ms font_metrics::width(char, LyXFont const&) (lyx)
 |   1.0 ms LaTeX::deplog(DepTable&) (lyx)
 | - 10.1 ms font_metrics::width(char const*, unsigned long, LyXFont 
const&) (lyx)


Does that mean that "font_metrics::width(char const*,...)" is using 10.1 
less time than its parent "font_metrics::width(char, LyXFont const&)"? 
IOW, is it to say that "- 10.1 ms" is the same as + 6361.1 ms" ?

Then why is there no deeper results for it?

Abdel.



Re: Profile: LyX/Mac 1.5.0svn Qt-4.1.3 -- Typing

2006-05-25 Thread Abdelrazak Younes

Abdelrazak Younes wrote:

Bennett Helm wrote:
This profile was generated by simply typing into the middle of a large 
document for 30 seconds.


I see that there is a lot of improvement compared to your former profile 
WRT qt4 frontends. Do you feel the improve in speed?
AFAICS the clear culprit is again font_metrics::width(). This is true 
for your first three patches (typing and scrolling with down keys). But 
I really don't understand where the time is spent inside this method (it 
is not shown in the deeper profile results):


 + 6371.2 ms font_metrics::width(char, LyXFont const&) (lyx)
 |   1.0 ms LaTeX::deplog(DepTable&) (lyx)
 | - 10.1 ms font_metrics::width(char const*, unsigned long, LyXFont 
const&) (lyx)


Does that mean that "font_metrics::width(char const*,...)" is using 10.1 
less time than its parent "font_metrics::width(char, LyXFont const&)"? 
IOW, is it to say that "- 10.1 ms" is the same as + 6361.1 ms" ?

Then why is there no deeper results for it?


Bennett,

I have enabled the font width caching in the qt4 frontend. Under windows 
I have a 5 seconds improvements when scrolling the UserGuide with 
pageDown (35 instead of 40).


Could you SVN update and try this please?

Thanks,
Abdel.



Re: Profile: LyX/Mac 1.5.0svn Qt-4.1.3 -- Typing

2006-05-26 Thread Jean-Marc Lasgouttes
> "Abdelrazak" == Abdelrazak Younes <[EMAIL PROTECTED]> writes:

Abdelrazak> I have enabled the font width caching in the qt4 frontend.
Abdelrazak> Under windows I have a 5 seconds improvements when
Abdelrazak> scrolling the UserGuide with pageDown (35 instead of 40).

If you go this route and it seems worth it, you should think about
replacing the std::map with something else (hash? vector?) that has
faster access. I remember that map searching was very visible in
profiles.

JMarc


Re: Profile: LyX/Mac 1.5.0svn Qt-4.1.3 -- Typing

2006-05-26 Thread Abdelrazak Younes

Jean-Marc Lasgouttes wrote:

"Abdelrazak" == Abdelrazak Younes <[EMAIL PROTECTED]> writes:



Abdelrazak> I have enabled the font width caching in the qt4 frontend.
Abdelrazak> Under windows I have a 5 seconds improvements when
Abdelrazak> scrolling the UserGuide with pageDown (35 instead of 40).

If you go this route and it seems worth it, you should think about
replacing the std::map with something else (hash? vector?) that has
faster access. I remember that map searching was very visible in
profiles.
  
OK, thanks for the info. As a side note, IMHO, there might be something 
wrong in the way QFontMetrics is used within LyX. I an going to read a 
bit the documentation and see if there is some other way to do what we 
want without the width caching. I don't promise anything though...


Abdel.



Re: Profile: LyX/Mac 1.5.0svn Qt-4.1.3 -- Typing

2006-05-26 Thread Bennett Helm

[To the list this time!]

On May 25, 2006, at 5:31 PM, Abdelrazak Younes wrote:


Bennett Helm wrote:
This profile was generated by simply typing into the middle of a  
large document for 30 seconds.


I see that there is a lot of improvement compared to your former  
profile WRT qt4 frontends. Do you feel the improve in speed?


A bit: I type a sentence and have to wait 10 seconds instead of 15  
for it to catch up.


AFAICS the clear culprit is again font_metrics::width(). This is  
true for your first three patches (typing and scrolling with down  
keys). But I really don't understand where the time is spent inside  
this method (it is not shown in the deeper profile results):


 + 6371.2 ms font_metrics::width(char, LyXFont const&) (lyx)
 |   1.0 ms LaTeX::deplog(DepTable&) (lyx)
 | - 10.1 ms font_metrics::width(char const*, unsigned long,  
LyXFont const&) (lyx)


Does that mean that "font_metrics::width(char const*,...)" is using  
10.1 less time than its parent "font_metrics::width(char, LyXFont  
const&)"? IOW, is it to say that "- 10.1 ms" is the same as +  
6361.1 ms" ?

Then why is there no deeper results for it?


I'm selectively editing the report -- cutting out anything that takes  
< 50ms or so on the assumption that we're not going to get  
significant improvements looking there right now. If you want the  
full report, I can post it. (It's big.)


Nonetheless, the report Shark.app generates for some reason shows  
only how much time the tree takes up rather than the individual  
processes within the tree. (I hope I'm using the proper language  
here.) The "+" indicates that I've expanded the branch of the tree,  
whereas the "-" indicates that I've collapsed it. So in the above  
example, 6360ms is used by the first font_metrics, 1ms by LaTeX, and  
10.1 by the second font_metrics (and everything beneath it in the tree).


I'll send a screen shot for the next profile.

Bennett



Re: Profile: LyX/Mac 1.5.0svn Qt-4.1.3 -- Typing

2006-05-26 Thread Abdelrazak Younes

Bennett Helm wrote:

[To the list this time!]

On May 25, 2006, at 5:31 PM, Abdelrazak Younes wrote:


Bennett Helm wrote:
This profile was generated by simply typing into the middle of a 
large document for 30 seconds.


I see that there is a lot of improvement compared to your former 
profile WRT qt4 frontends. Do you feel the improve in speed?


A bit: I type a sentence and have to wait 10 seconds instead of 15 for 
it to catch up.

Hey man, this is a 33% improvement!
I have enabled the width cache now so maybe we'll see another 33%... 
then yes another 33% and were done ;-)


AFAICS the clear culprit is again font_metrics::width(). This is true 
for your first three patches (typing and scrolling with down keys). 
But I really don't understand where the time is spent inside this 
method (it is not shown in the deeper profile results):


 + 6371.2 ms font_metrics::width(char, LyXFont const&) (lyx)
 |   1.0 ms LaTeX::deplog(DepTable&) (lyx)
 | - 10.1 ms font_metrics::width(char const*, unsigned long, LyXFont 
const&) (lyx)


Does that mean that "font_metrics::width(char const*,...)" is using 
10.1 less time than its parent "font_metrics::width(char, LyXFont 
const&)"? IOW, is it to say that "- 10.1 ms" is the same as + 6361.1 
ms" ?

Then why is there no deeper results for it?


I'm selectively editing the report -- cutting out anything that takes 
< 50ms or so on the assumption that we're not going to get significant 
improvements looking there right now. If you want the full report, I 
can post it. (It's big.)
I am not really interested in the full report but only in everything 
that is deeper than the first font_metrics::width(char, LyXFont const&). 
If it is too time consuming to cut down the report could you please send 
it to me if it's less than 5Megs?




Nonetheless, the report Shark.app generates for some reason shows only 
how much time the tree takes up rather than the individual processes 
within the tree. (I hope I'm using the proper language here.) The "+" 
indicates that I've expanded the branch of the tree, whereas the "-" 
indicates that I've collapsed it. So in the above example, 6360ms is 
used by the first font_metrics, 1ms by LaTeX, and 10.1 by the second 
font_metrics (and everything beneath it in the tree).

This doesn't make sense...
font_metrics::width(char, LyXFont const&)  is just a wrapper around the 
second:


   /// return the width of the char in the font
   inline int width(lyx::char_type c, LyXFont const & f) {
   return width(&c, 1, f);
   }

Abdel.



I'll send a screen shot for the next profile.

Bennett







Re: Profile: LyX/Mac 1.5.0svn Qt-4.1.3 -- Typing

2006-05-26 Thread Abdelrazak Younes

Bennett Helm wrote:

On May 25, 2006, at 6:39 PM, Abdelrazak Younes wrote:

I have enabled the font width caching in the qt4 frontend. Under 
windows I have a 5 seconds improvements when scrolling the UserGuide 
with pageDown (35 instead of 40).


Could you SVN update and try this please?


Wow! That's an amazing difference: it now keeps up with my typing. 


Alleluia Brother! :-)
Is it comparable with Qt3 now? What about the other use cases?

Here's the typing profile. I'll send the promised screenshot privately: 
even in low quality it's > 100KB. (If anyone else wants it, let me know.)


I got it thanks. This seems like a nice tool.

Abdel.



Re: Profile: LyX/Mac 1.5.0svn Qt-4.1.3 -- Typing

2006-05-26 Thread Abdelrazak Younes

Bennett Helm wrote:

On May 25, 2006, at 6:39 PM, Abdelrazak Younes wrote:

I have enabled the font width caching in the qt4 frontend. Under 
windows I have a 5 seconds improvements when scrolling the UserGuide 
with pageDown (35 instead of 40).


Could you SVN update and try this please?


Wow! That's an amazing difference: it now keeps up with my typing. 
Here's the typing profile. I'll send the promised screenshot 
privately: even in low quality it's > 100KB. (If anyone else wants it, 
let me know.)

Could you please expand that node?

| | | | | | | | - 3644.8 ms BufferView::Pimpl::update(Update::flags) (lyx)

Abdel.



Re: Profile: LyX/Mac 1.5.0svn Qt-4.1.3 -- Typing

2006-05-26 Thread Bennett Helm


On May 26, 2006, at 9:39 AM, Abdelrazak Younes wrote:


Bennett Helm wrote:

On May 25, 2006, at 6:39 PM, Abdelrazak Younes wrote:
I have enabled the font width caching in the qt4 frontend. Under  
windows I have a 5 seconds improvements when scrolling the  
UserGuide with pageDown (35 instead of 40).


Could you SVN update and try this please?

Wow! That's an amazing difference: it now keeps up with my typing.


Alleluia Brother! :-)
Is it comparable with Qt3 now? What about the other use cases?


It's close, but still noticeably slower in typing, and even more so  
scrolling.


Scrolling with pagedown through the User's Guide, Qt4 takes 223  
seconds the first time (as it generates all math previews), and 113  
seconds the second time (with all previews already generated). For  
reference, Qt3 takes 71 seconds the first time and 27 seconds the  
second.


Do you want profiles again for these other cases?

Bennett


Re: Profile: LyX/Mac 1.5.0svn Qt-4.1.3 -- Typing

2006-05-26 Thread Abdelrazak Younes

Bennett Helm wrote:


On May 26, 2006, at 9:39 AM, Abdelrazak Younes wrote:


Bennett Helm wrote:

On May 25, 2006, at 6:39 PM, Abdelrazak Younes wrote:
I have enabled the font width caching in the qt4 frontend. Under 
windows I have a 5 seconds improvements when scrolling the 
UserGuide with pageDown (35 instead of 40).


Could you SVN update and try this please?

Wow! That's an amazing difference: it now keeps up with my typing.


Alleluia Brother! :-)
Is it comparable with Qt3 now? What about the other use cases?


It's close, but still noticeably slower in typing, and even more so 
scrolling.


Scrolling with pagedown through the User's Guide, Qt4 takes 223 
seconds the first time (as it generates all math previews), and 113 
seconds the second time (with all previews already generated). For 
reference, Qt3 takes 71 seconds the first time and 27 seconds the second.


Do you want profiles again for these other cases?


Yes that would be interesting. I suspect that, as shown in your other 
profile, we are hitting there a performance problem of the Qt4 API on Mac.


Abdel.



Re: Profile: LyX/Mac 1.5.0svn Qt-4.1.3 -- Typing

2006-05-29 Thread Jean-Marc Lasgouttes
> "Bennett" == Bennett Helm <[EMAIL PROTECTED]> writes:

Bennett> On May 25, 2006, at 6:39 PM, Abdelrazak Younes wrote:
>> I have enabled the font width caching in the qt4 frontend. Under
>> windows I have a 5 seconds improvements when scrolling the
>> UserGuide with pageDown (35 instead of 40).
>> 
>> Could you SVN update and try this please?

Bennett> Wow! That's an amazing difference: it now keeps up with my
Bennett> typing. Here's the typing profile. I'll send the promised
Bennett> screenshot privately: even in low quality it's > 100KB. (If
Bennett> anyone else wants it, let me know.)

So the next question is: what does the following patch does to
1.5/qt3 (or 1.4/qt3) in LyX/Mac? I remember that at the time I found
caching did not help on linux but it may be that I was completely
wrong.

Also, does this patch help on windows (native and X11)?

JMarc

Index: src/frontends/qt3/qfont_loader.h
===
--- src/frontends/qt3/qfont_loader.h	(revision 13948)
+++ src/frontends/qt3/qfont_loader.h	(working copy)
@@ -18,9 +18,9 @@
 #include 
 #include 
 
-#if QT_VERSION < 0x030100
+//#if QT_VERSION < 0x030100
 #define USE_LYX_FONTCACHE
-#endif
+//#endif
 
 #if defined(USE_LYX_FONTCACHE)
 #include 


Re: Profile: LyX/Mac 1.5.0svn Qt-4.1.3 -- Typing

2006-05-29 Thread Jean-Marc Lasgouttes
> "Jean-Marc" == Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes:

Jean-Marc> So the next question is: what does the following patch does
Jean-Marc> to 1.5/qt3 (or 1.4/qt3) in LyX/Mac? I remember that at the
Jean-Marc> time I found caching did not help on linux but it may be
Jean-Marc> that I was completely wrong.

Jean-Marc> Also, does this patch help on windows (native and X11)?

I should have tried to compile first. Correct patch follows. It seems
that nobody tried to compile LyX 1.4 with Qt 3.0...

JMarc

Index: src/frontends/qt3/qfont_loader.C
===
--- src/frontends/qt3/qfont_loader.C	(revision 13948)
+++ src/frontends/qt3/qfont_loader.C	(working copy)
@@ -359,7 +359,7 @@
 }
 
 
-int QLFontInfo::width(Uchar val) const
+int QLFontInfo::width(Uchar val)
 {
 // Starting with version 3.1.0, Qt/X11 does its own caching of
 // character width, so it is not necessary to provide ours.
Index: src/frontends/qt3/qfont_loader.h
===
--- src/frontends/qt3/qfont_loader.h	(revision 13948)
+++ src/frontends/qt3/qfont_loader.h	(working copy)
@@ -18,9 +18,9 @@
 #include 
 #include 
 
-#if QT_VERSION < 0x030100
+//#if QT_VERSION < 0x030100
 #define USE_LYX_FONTCACHE
-#endif
+//#endif
 
 #if defined(USE_LYX_FONTCACHE)
 #include 
@@ -35,7 +35,7 @@
 	QLFontInfo(LyXFont const & f);
 
 	/// Return pixel width for the given unicode char
-	int width(Uchar val) const;
+	int width(Uchar val);
 
 	/// The font instance
 	QFont font;


Re: Profile: LyX/Mac 1.5.0svn Qt-4.1.3 -- Typing

2006-05-29 Thread Bennett Helm

On May 29, 2006, at 12:15 PM, Jean-Marc Lasgouttes wrote:


"Bennett" == Bennett Helm <[EMAIL PROTECTED]> writes:


Bennett> On May 25, 2006, at 6:39 PM, Abdelrazak Younes wrote:

I have enabled the font width caching in the qt4 frontend. Under
windows I have a 5 seconds improvements when scrolling the
UserGuide with pageDown (35 instead of 40).

Could you SVN update and try this please?


Bennett> Wow! That's an amazing difference: it now keeps up with my
Bennett> typing. Here's the typing profile. I'll send the promised
Bennett> screenshot privately: even in low quality it's > 100KB. (If
Bennett> anyone else wants it, let me know.)

So the next question is: what does the following patch does to
1.5/qt3 (or 1.4/qt3) in LyX/Mac? I remember that at the time I found
caching did not help on linux but it may be that I was completely
wrong.


I've tried it with 1.4/qt3 on Mac. It seems to help in two respects:

1. scrolling speed gives me an improvement similar to what Abdel  
reported: 39 seconds down to 35.


2. although typing doesn't lag on either version, without the patch I  
can push processor usage up to 75-80% when typing fast in lyx,  
whereas with it I can't get above 50%.


I'll test later to see if it makes LyX/Mac on my slow (466MHz) laptop  
bearable.


I haven't compiled an appropriate version of lyx with debug support,  
so I can't profile as is. Let me know if you want me to. Also, let me  
know if some other test would be appropriate.


Bennett


Re: Profile: LyX/Mac 1.5.0svn Qt-4.1.3 -- Typing

2006-05-29 Thread Abdelrazak Younes

Jean-Marc Lasgouttes wrote:

"Bennett" == Bennett Helm <[EMAIL PROTECTED]> writes:


Bennett> On May 25, 2006, at 6:39 PM, Abdelrazak Younes wrote:

I have enabled the font width caching in the qt4 frontend. Under
windows I have a 5 seconds improvements when scrolling the
UserGuide with pageDown (35 instead of 40).

Could you SVN update and try this please?


Bennett> Wow! That's an amazing difference: it now keeps up with my
Bennett> typing. Here's the typing profile. I'll send the promised
Bennett> screenshot privately: even in low quality it's > 100KB. (If
Bennett> anyone else wants it, let me know.)

So the next question is: what does the following patch does to
1.5/qt3 (or 1.4/qt3) in LyX/Mac? I remember that at the time I found
caching did not help on linux but it may be that I was completely
wrong.

Also, does this patch help on windows (native and X11)?


I guess this will not compile because width() is const. Attached a 
proper patch (untested). FWIW, I don't think you will notice a great 
difference in linux or in windows for qt3.


Abdel.

Index: qfont_loader.C
===
--- qfont_loader.C  (revision 13933)
+++ qfont_loader.C  (working copy)
@@ -359,7 +359,7 @@
 }
 
 
-int QLFontInfo::width(Uchar val) const
+int QLFontInfo::width(Uchar val)
 {
 // Starting with version 3.1.0, Qt/X11 does its own caching of
 // character width, so it is not necessary to provide ours.
Index: qfont_loader.h
===
--- qfont_loader.h  (revision 13933)
+++ qfont_loader.h  (working copy)
@@ -18,9 +18,9 @@
 #include 
 #include 
 
-#if QT_VERSION < 0x030100
+//#if QT_VERSION < 0x030100
 #define USE_LYX_FONTCACHE
-#endif
+//#endif
 
 #if defined(USE_LYX_FONTCACHE)
 #include 
@@ -35,7 +35,7 @@
QLFontInfo(LyXFont const & f);
 
/// Return pixel width for the given unicode char
-   int width(Uchar val) const;
+   int width(Uchar val);
 
/// The font instance
QFont font;


Re: Profile: LyX/Mac 1.5.0svn Qt-4.1.3 -- Typing

2006-05-30 Thread Andre Poenitz
On Thu, May 25, 2006 at 11:31:43PM +0200, Abdelrazak Younes wrote:
> I see that there is a lot of improvement compared to your former profile 
> WRT qt4 frontends. Do you feel the improve in speed?
> AFAICS the clear culprit is again font_metrics::width(). This is true 
> for your first three patches (typing and scrolling with down keys). But 
> I really don't understand where the time is spent inside this method (it 
> is not shown in the deeper profile results):
> 
>  + 6371.2 ms font_metrics::width(char, LyXFont const&) (lyx)
>  |   1.0 ms LaTeX::deplog(DepTable&) (lyx)
>  | - 10.1 ms font_metrics::width(char const*, unsigned long, LyXFont 
> const&) (lyx)

Because almost everything in this method is already inlined.

That's btw also the reason I reduced the deep array accesses from two to
one.

If you want improvements in the area you'd probably spend some time on
the various LyXFont flags. Right now some (simple...) calculations are 
still done in font_metrics::widht. One would need to change the
environment in a way that even those are not needed.

> Then why is there no deeper results for it?

Everything already inlined.

Andre'


Re: Profile: LyX/Mac 1.5.0svn Qt-4.1.3 -- Typing

2006-05-30 Thread Bennett Helm

On May 29, 2006, at 12:52 PM, Bennett Helm wrote:


I've tried it with 1.4/qt3 on Mac. It seems to help in two respects:

1. scrolling speed gives me an improvement similar to what Abdel  
reported: 39 seconds down to 35.


2. although typing doesn't lag on either version, without the patch  
I can push processor usage up to 75-80% when typing fast in lyx,  
whereas with it I can't get above 50%.


I'll test later to see if it makes LyX/Mac on my slow (466MHz)  
laptop bearable.


Now I've tested: it is usable on my slow laptop, but it just barely  
keeps up with typing speed. More speed improvements would be welcome,  
but this is a great help.


Bennett


Re: Profile: LyX/Mac 1.5.0svn Qt-4.1.3 -- Typing

2006-05-31 Thread Abdelrazak Younes

Bennett Helm wrote:

On May 29, 2006, at 12:52 PM, Bennett Helm wrote:


I've tried it with 1.4/qt3 on Mac. It seems to help in two respects:

1. scrolling speed gives me an improvement similar to what Abdel 
reported: 39 seconds down to 35.


2. although typing doesn't lag on either version, without the patch I 
can push processor usage up to 75-80% when typing fast in lyx, whereas 
with it I can't get above 50%.


I'll test later to see if it makes LyX/Mac on my slow (466MHz) laptop 
bearable.


Now I've tested: it is usable on my slow laptop, but it just barely 
keeps up with typing speed. More speed improvements would be welcome, 
but this is a great help.


I have been experimenting using a QPicture "cache" inside QLPainter 
instead of drawing directly to the pixmap for each operation. The 
purpose of a QPicture is to record painting operation and replay them on 
a file, an image or the screen when told to. The gain in speed is 
*impressive*. Unfortunately the lyx core drawing assumes that the 
painting device is a pixmap so the drawing on screen is all scrambled.
Fixing the drawing routine would break the other frontends so I don't 
think this would be a welcome change in the short term.


In the longer term, I think it should be possible to use Qt rich text 
editor directly instead of doing everything by hand.


Abdel.



Re: Profile: LyX/Mac 1.5.0svn Qt-4.1.3 -- Typing

2006-05-31 Thread Jean-Marc Lasgouttes
> "Abdelrazak" == Abdelrazak Younes <[EMAIL PROTECTED]> writes:

Abdelrazak> I have been experimenting using a QPicture "cache" inside
Abdelrazak> QLPainter instead of drawing directly to the pixmap for
Abdelrazak> each operation. The purpose of a QPicture is to record
Abdelrazak> painting operation and replay them on a file, an image or
Abdelrazak> the screen when told to. The gain in speed is
Abdelrazak> *impressive*. Unfortunately the lyx core drawing assumes
Abdelrazak> that the painting device is a pixmap so the drawing on
Abdelrazak> screen is all scrambled. Fixing the drawing routine would
Abdelrazak> break the other frontends so I don't think this would be a
Abdelrazak> welcome change in the short term.

What kind of changes would you need?

Abdelrazak> In the longer term, I think it should be possible to use
Abdelrazak> Qt rich text editor directly instead of doing everything
Abdelrazak> by hand.

Can we add tables in there? Collapsable insets?

JMarc


Re: Profile: LyX/Mac 1.5.0svn Qt-4.1.3 -- Typing

2006-05-31 Thread Abdelrazak Younes

Jean-Marc Lasgouttes wrote:

"Abdelrazak" == Abdelrazak Younes <[EMAIL PROTECTED]> writes:


Abdelrazak> I have been experimenting using a QPicture "cache" inside
Abdelrazak> QLPainter instead of drawing directly to the pixmap for
Abdelrazak> each operation. The purpose of a QPicture is to record
Abdelrazak> painting operation and replay them on a file, an image or
Abdelrazak> the screen when told to. The gain in speed is
Abdelrazak> *impressive*. Unfortunately the lyx core drawing assumes
Abdelrazak> that the painting device is a pixmap so the drawing on
Abdelrazak> screen is all scrambled. Fixing the drawing routine would
Abdelrazak> break the other frontends so I don't think this would be a
Abdelrazak> welcome change in the short term.

What kind of changes would you need?


I am sure yet, I have to read the painting code first. I would say that 
the main issue is that everything that deals with the background by 
painting a rectangle should be worked out and delegated to the frontend. 
The core should just say the the painter:

"I am drawing inside this rectangle"
"Please erase everything in this rectangle"

But as I said this is just loud thinking, I am not sure what the core is 
saying presently. I will have to read the code first... when/if I can 
find some time :-(



Abdelrazak> In the longer term, I think it should be possible to use
Abdelrazak> Qt rich text editor directly instead of doing everything
Abdelrazak> by hand.

Can we add tables in there? Collapsable insets?


I think we can embed QTextEdit inside QTextEdit so I would say yes but I 
don't know for sure. I just had a quick glance at it and it looked 
pretty flexible.


Abdel.



Re: Profile: LyX/Mac 1.5.0svn Qt-4.1.3 -- Typing

2006-06-07 Thread Andre Poenitz
On Wed, May 31, 2006 at 11:23:59AM +0200, Jean-Marc Lasgouttes wrote:
> > "Abdelrazak" == Abdelrazak Younes <[EMAIL PROTECTED]> writes:
> 
> Abdelrazak> I have been experimenting using a QPicture "cache" inside
> Abdelrazak> QLPainter instead of drawing directly to the pixmap for
> Abdelrazak> each operation. The purpose of a QPicture is to record
> Abdelrazak> painting operation and replay them on a file, an image or
> Abdelrazak> the screen when told to. The gain in speed is
> Abdelrazak> *impressive*. Unfortunately the lyx core drawing assumes
> Abdelrazak> that the painting device is a pixmap so the drawing on
> Abdelrazak> screen is all scrambled. Fixing the drawing routine would
> Abdelrazak> break the other frontends so I don't think this would be a
> Abdelrazak> welcome change in the short term.
> 
> What kind of changes would you need?
> 
> Abdelrazak> In the longer term, I think it should be possible to use
> Abdelrazak> Qt rich text editor directly instead of doing everything
> Abdelrazak> by hand.
> 
> Can we add tables in there? Collapsable insets?

One can pretty much do everything we have right now (sort of...).

However, going that route is pretty close to what KLyX did once: 
penetration of Qt into the LyX kernel, i.e. the death of GUII.

[Well, maybe there would be a GUII conform solution, but this would mean
moving big parts (row cache etc.) to the frontends. I am not sure this
is much better than sticking to a single frontend in the long run]

Andre'