Welcome to NeoOffice developer notes and announcements
NeoOffice
Developer notes and announcements
 
 

This website is an archive and is no longer active
NeoOffice announcements have moved to the NeoOffice News website


Support
· Forums
· NeoOffice Support
· NeoWiki


Announcements
· Twitter @NeoOffice


Downloads
· Download NeoOffice


  
NeoOffice :: View topic - High CPU Use When Mouse Scrolling
High CPU Use When Mouse Scrolling
 
   NeoOffice Forum Index -> NeoOffice Releases
View previous topic :: View next topic  
Author Message
noibs
Sentinel


Joined: Dec 09, 2006
Posts: 22

PostPosted: Sun Jul 11, 2010 10:09 am    Post subject: High CPU Use When Mouse Scrolling

There's a particular ODT format document (1.2 ODF format version) of mine that's large (275 pages) with many inline graphics objects. The size is 8.5 MB.

Now, whenever I scroll the document a few pages using my mouse scroll wheel, the NeoOffice CPU use exceeds 100% and the scrolling is very slow and uneven. The fans on my MacBook come on almost immediately.

I have a companion document that about the same size with the same number of inline graphics objects that doesn't do this when I scroll.

Any ideas?
Back to top
noibs
Sentinel


Joined: Dec 09, 2006
Posts: 22

PostPosted: Sun Jul 11, 2010 10:23 am    Post subject: High CPU Use When Mouse Scrolling - Additional Information

Just an update to my original post.

Using the most recent Mac version of Open Office, CPU use when scrolling the same document is between 20% and 30%--still high, but not 100%+ as is the case in NeoOffice. I realize the current version of NeoOffice is based on an older version of Open Office.
Back to top
pluby
The Architect
The Architect


Joined: Jun 16, 2003
Posts: 11949

PostPosted: Sun Jul 11, 2010 10:52 am    Post subject:

Since your document uses a lot less CPU in a newer version of OpenOffice.org than the one NeoOffice uses and OpenOffice.org 3.2.1 has some major performance improvements that are not in NeoOffice's underlying OpenOffice.org 3.1.1 code, the bad news is that you may need the newer OpenOffice.org version to work around this.

Nevertheless, there are some things that you can try changing in your document that might help:

1. Disable spellchecking - When you have spellchecking enabled, NeoOffice spends a lot of CPU spellchecking your entire document while you work. For a 275 page document, that is a lot of work it must do that can be avoided by unclicking the AutoSpellcheck toolbar button.

2. Disable paragraph splitting options - Highlight your entire document by selecting the Edit :: Select All menu and then select the Format :: Paragraph menu. In the dialog that appears, click on the Text Flow tab and make sure that all of the checkboxes in the "Options" section are unchecked. If any of these checkboxes are checked, CPU usage can become very high.

3. Insert manual page breaks - For NeoOffice to determine where to display any text or graphic, it must layout all of the text and graphics preceding it in the document. By inserting manual page breaks every so often throughout the document, in many cases you can significantly cut down how much layout of preceding text that NeoOffice must do.

Hope that helps.

Patrick
Back to top
noibs
Sentinel


Joined: Dec 09, 2006
Posts: 22

PostPosted: Sun Jul 11, 2010 5:49 pm    Post subject: Thanks

Patrick,

Thanks for the suggestions. I don't have auto spell-checking enabled. The document is an Accounting workbook that students use in a course I teach. Everything in the document is assigned some kind of paragraph style. I don't believe that I've enabled any paragraph splitting options but I'll check. Option (3) is out of the question because the workbook is being constantly updated and changed from one semester to the next and I can't afford hard page breaks.

Thanks again.
Back to top
pluby
The Architect
The Architect


Joined: Jun 16, 2003
Posts: 11949

PostPosted: Sun Jul 11, 2010 6:03 pm    Post subject: Re: Thanks

noibs wrote:
....Option (3) is out of the question because the workbook is being constantly updated and changed from one semester to the next and I can't afford hard page breaks.


So essentially your document is a 275 page book with one chapter? I am not saying that you need to put a hard page break after each page to get any performance improvement. I am only suggesting that you insert a hard page break at the end of each chapter or major section. Even if each chapter or a major section is 10 to 20 pages long, in many cases after each such block can really improve layout speed for large documents like yours.

Patrick
Back to top
pluby
The Architect
The Architect


Joined: Jun 16, 2003
Posts: 11949

PostPosted: Sun Jul 11, 2010 6:23 pm    Post subject:

I have another idea that you can try. Instead of me listing a bunch of things for you to change that may or may not help, I think a better idea would be for you to collect a sample of the NeoOffice application when CPU usage shoots up to 100%.

Hopefully, from such a sample we might be able to identify what specific processing NeoOffice is actually doing that needs 100% CPU so that we can recommend a more specific change to your document.

To collect a sample of the NeoOffice process, following the instructions in this NeoWiki article. I would recommend do steps 1 through 5 in that article and then, when CPU shoots up, immediately switch to the Activity Monitor application and do steps 6 through 8. The faster you can start the sampling (step 6) in the Activity Monitor application, the better the sample will be for us.

Patrick
Back to top
noibs
Sentinel


Joined: Dec 09, 2006
Posts: 22

PostPosted: Mon Jul 12, 2010 6:30 pm    Post subject: Sample Of NeoOffice

Patrick,

I opened my large document and waited for things to settle down. I went to the middle of the document and began scrolling with my mouse scroll wheel. That was all. Activity Monitor showed about 103% CPU use. I think I got a good, quick sample; however, within 3 seconds, CPU use by NeoOffice was back to 2% to 3%.

I attached a text file with the sample. I'm going to be traveling the next few days (with a Dell Mini 10v hackintosh), so I won't be able to do anything more for a while with respect to this issue. Hopefully the sample will give you some answers.

What's ironic about this whole thing is that my #1 reason for using NeoOffice instead of OpenOffice is the problem OpenOffice has with mouse wheel scrolling on Macs. With scroll speed set as fast as possible within OSX, one complete revolution of a mouse scroll wheel (I've tried several) moves an OpenOffice writer document about a half page--way too slow. Therefore, when I use OpenOffice I use the shareware Steermouse driver that allows for highly custom scroll wheel speeds for each application.

With NeoOffice, the mouse wheel scrolling speed is about the same as it is for other Mac apps. Therefore, whatever you are doing in NeoOffice to change scroll wheel behavior (as compared to stock OpenOffice) might be contributing my my CPU saturation when scrolling.

Thanks again.
Back to top
pluby
The Architect
The Architect


Joined: Jun 16, 2003
Posts: 11949

PostPosted: Tue Jul 13, 2010 9:41 am    Post subject: Re: Sample Of NeoOffice

noibs wrote:
With NeoOffice, the mouse wheel scrolling speed is about the same as it is for other Mac apps. Therefore, whatever you are doing in NeoOffice to change scroll wheel behavior (as compared to stock OpenOffice) might be contributing my my CPU saturation when scrolling.


I think you have it backwards. We don't change scroll wheel behavior. Instead, we pass all native scroll wheel events directly through to the OpenOffice.org Writer code. In fact, NeoOffice coalesces consecutive mouse wheel events into a single mouse wheel event to improve performance. This makes me think that maybe your custom mouse driver is either flooding NeoOffice with mouse wheel events or it is disabling our event coalescing by interspersing one or more non-mouse wheel events between each mouse wheel event.

To test my theory, I tried to test my theory by seeing if I could reproduce the behavior that you are seeing. Since the sample that you attached indicates that most of the processingthat is occurring is calculation of text width and height for positioning (which is normal), I created a 300+ page Writer document. The entire document uses the Times Roman font and is filled with standard "lorem ipsum" text.

With my test document, no matter where I place the cursor in my document, spinning the mouse scroll wheel never yields more than 30% or so CPU usage. What is really interesting is that when I tried the same test document in OpenOffice.org 3.1.1, CPU usage was routinely in the 40% to 60% range whether I was scrolling the mouse wheel or not.

At this point, I think we need to step back and see what is unique about your machine. Can you answer the following questions?:

1. What version of Mac OS X (10.4.11, 10.5.8, or 10.6.4) and what type of processor (Intel or PowerPC) are you running?

2. What version and patch are shown in NeoOffice's Help :: About NeoOffice menu?

3. What specific font do you use most in your document?

Hopefully, your answers to the above questions will give us some hints as to why I am seeing such different CPU usage levels than you.

Patrick
Back to top
noibs
Sentinel


Joined: Dec 09, 2006
Posts: 22

PostPosted: Tue Jul 13, 2010 1:06 pm    Post subject: System Info

Patrick,

I'm away from home (and will be for a while), but I can still answer your questions.

1. Hardware: Mid 2007 Macbook w/ 2.16ghz Core 2 Duo w/4MB cache. 3GB of addressable RAM (actually has 4GB of physical RAM). 320GB hard drive, 80% free space.
2. Neooffice version and patch. Latest versions of both. I always update to the most recent patch and I've been using the latest version of NeoOffice since it was released.
3. The primary font used in 99.99% of my large document I was scrolling is Times New Roman in various sizes. All text in the document is assigned a paragraph style. The footer contains a field that corresponds to Heading 1 (chapter name). The footer also contains a self-generated page number.

The noteworthy thing about the document itself is that it contains perhaps 125 in-line graphics images. These are mostly pieces of Calc (spreadsheet) documents that were copied to the clipboard and then pasted into my Writer document as GDI Metafile objects. Some are quite complex and cover most of a page. Remember that this is an Accounting book.

I would like to email you a copy of the document; however, I won't be home for a while and don't have a current version with me. Also, it's 8.5mb in size.

Thanks.
Back to top
pluby
The Architect
The Architect


Joined: Jun 16, 2003
Posts: 11949

PostPosted: Tue Jul 13, 2010 1:32 pm    Post subject: Re: System Info

noibs wrote:
I would like to email you a copy of the document; however, I won't be home for a while and don't have a current version with me. Also, it's 8.5mb in size.


That size is way too large to for e-mailing. Since it is also too large to attach in a post, can you upload it to a free upload site (a Google search should show lots of sites that support this) and then post a link to where you uploaded the file?

Patrick
Back to top
noibs
Sentinel


Joined: Dec 09, 2006
Posts: 22

PostPosted: Tue Jul 13, 2010 6:02 pm    Post subject: Reply

Patrick,

Two things:

1. I'm running 10.6.3. I upgraded from 10.5.8 to 10.6.3 about six weeks ago. I can't be sure, but I don't believe I had this problem under 10.5.x.

2. I'm on vacation and don't have access to the file. A week from today, I'll put the file on a custom Mobile Me Web page and put the link here.

I normally would have a copy of the file with me, but some things got messed up as we were trying to leave and it didn't get copied to my Dell hackintosh.
Back to top
pluby
The Architect
The Architect


Joined: Jun 16, 2003
Posts: 11949

PostPosted: Tue Jul 13, 2010 7:34 pm    Post subject: Re: Reply

noibs wrote:
1. I'm running 10.6.3. I upgraded from 10.5.8 to 10.6.3 about six weeks ago. I can't be sure, but I don't believe I had this problem under 10.5.x.


If the problem did not happen with 10.5.8, then it is possible that the custom mouse driver software does not behave as well when running on Snow Leopard. Although it probably won't change anything, can you select the Apple :: Software Update menu and upgrade to 10.6.4? Apple released 10.6.4 a few weeks ago and it is possible that Apple's fixes in Mac OS X may help.

noibs wrote:
2. I'm on vacation and don't have access to the file. A week from today, I'll put the file on a custom Mobile Me Web page and put the link here.


That sounds good. Then I will be able to see if I can reproduce the same problem on my machine.

Patrick
Back to top
noibs
Sentinel


Joined: Dec 09, 2006
Posts: 22

PostPosted: Wed Jul 21, 2010 7:52 am    Post subject: High CPU Use When Mouse Scrolling

Patrick,

I've sent you a personal message containing an address where you can download my odt file that leads to high CPU use when mouse scrolling.

Note that when this happens I'm not using my custom Steermouse driver. I'm only using the standard Apple mouse driver under 10.6.3. I've only installed Steermouse when I've used OpenOffice.

For the first 10 seconds or so after opening NeoOffice and doing fast mouse scrolling, CPU use in Activity Monitor will not peak. After that time, it does peak and will then peak again as soon as I start fast scrolling.

My standard mouse is a fairly new Kensington Mouse in a Box that has two left-right buttons plus a scroll wheel (that also has a button). The scrolling speed in the mouse system preferences under 10.6.3 is set to the fastest level. I do NOT use the Kensington mouse software.

I'm beginning to wonder if my mouse is part of the problem. Even though my Mouse in a Box model is the newest version of this mouse, the basic mouse has been around for a long time. I have to set the scrolling speed in 10.6.3's system preferences to the fastest possible level in order to get just acceptable scroll wheel responsiveness in NeoOffice and other applications.

Thanks.
Back to top
pluby
The Architect
The Architect


Joined: Jun 16, 2003
Posts: 11949

PostPosted: Wed Jul 21, 2010 1:48 pm    Post subject:

I download your .odt file successfully so I will see if I can reproduce the problem that you see over the next day.

I will post again when I have some results to report.

Patrick
Back to top
pluby
The Architect
The Architect


Joined: Jun 16, 2003
Posts: 11949

PostPosted: Fri Jul 23, 2010 10:06 pm    Post subject:

I have been able to reproduce the 100% CPU usage with your document. The good news is that I do not think that it is caused by your mouse driver because I was able to reproduce it without touching the mouse wheel. I only needed to click on the vertical scroll bar repeatedly to trigger to the problem.

I also was able to use Apple's "Shark" development tool to find out which code is consuming so much CPU and it is the font glyph size calculation code. In rare cases, NeoOffice's underlying OpenOffice.org code will query not only how many pixels a word requires for a given font and font size, but it will query the exactly dimensions of each of the glyphs in a word.

Querying glyph dimensions is much more CPU intensive than measuring the length of a word so this is where the problem is so clearly the NeoOffice glyph querying code is less efficient than the equivalent OpenOffice.org code so I will look at our code and see if there are any speed bottlenecks in our code that we can eliminate.

Patrick
Back to top
Display posts from previous:   
   NeoOffice Forum Index -> NeoOffice Releases All times are GMT - 7 Hours
Goto page 1, 2  Next
Page 1 of 2

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Powered by phpBB © 2001, 2005 phpBB Group

All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest © Planamesa Inc.
NeoOffice is a registered trademark of Planamesa Inc. and may not be used without permission.
PHP-Nuke Copyright © 2005 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.