Issue 101016 - Particular picture objects make OOo unusable slow
Summary: Particular picture objects make OOo unusable slow
Status: CLOSED FIXED
Alias: None
Product: Writer
Classification: Application
Component: editing (show other issues)
Version: OOo 3.1 RC1
Hardware: PC Windows XP
: P3 Trivial (vote)
Target Milestone: ---
Assignee: wolframgarten
QA Contact: issues@sw
URL:
Keywords: regression
Depends on:
Blocks: 95768
  Show dependency tree
 
Reported: 2009-04-10 18:13 UTC by Rainer Bielefeld
Modified: 2013-08-07 14:43 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Sample document (97.12 KB, application/vnd.oasis.opendocument.text)
2009-04-10 18:14 UTC, Rainer Bielefeld
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description Rainer Bielefeld 2009-04-10 18:13:15 UTC
"Ooo  3.1.0 RC1 multilingual version German UI WIN XP: [OOO310m9 (Build 9396)]"
becomes unusable slow for WRITER documents containing particular pictures with
complex lines contents. The same documents work fine with 3.0.1.

Please try to type quickly some text in my sample document "test_502.odt" and
you should see of the text appears slowly character by character. CPU load goes
to 100%

If you do the same test with 3.0.1 every character should appear immediately
when you type it.

Hundreds of my documents containing particular pictures as my sample document
become unusable for me using 3.1.0., so I see this problem as a showstopper.
Comment 1 Rainer Bielefeld 2009-04-10 18:14:48 UTC
Created attachment 61508 [details]
Sample document
Comment 2 Rainer Bielefeld 2009-04-10 18:24:34 UTC
Same bad result with "Ooo Dev 3.2.0 multilingual version German UI WIN XP:
[DEV300m44 (Build 9395)]".

My system:
Graphic Card: Nvidia GeForce 7300 LE
Processor: AMD Athlon 64 Bit 3500+
Monitor : 1024*768
OS: WIN XP SP3
Comment 3 merschmann 2009-04-10 20:44:38 UTC
Confirmed with a similar Windows system.

Sample doc was fine in 3.0 -> regression 
Comment 4 merschmann 2009-04-10 20:45:13 UTC
Reasigning
Comment 5 stefan.baltzer 2009-04-12 20:39:26 UTC
SBA->OD: Please have a look at this ASAP, thx.
The "as character" anchored drawings seem to be the cause.
Put AW, MRU and myself on c/c.
Comment 6 michael.ruess 2009-04-14 11:34:55 UTC
MRU->OD: please have a look, this regression is easily to reproduce. Just scroll
up and down or type some text in the attached document.
The objects seem to be graphic objects pasted from OOo Draw.
Comment 7 Oliver-Rainer Wittmann 2009-04-14 12:43:57 UTC
First investigation reveals the following:
- The pictures/graphics are Draw graphics of the same embedded StarView metafile.
- Rendering of these Draw graphics in Writer is slower compared to OOo 3.0.1
- Broken in DEV300m30 - in DEV300m29 the rendering performance is ok.
- Rendering of these Draw graphics in Draw is also slower than in OOo 3.0.1

OD->AW: Please take over.
Comment 8 Armin Le Grand 2009-04-14 14:39:54 UTC
AW: I took a look. Each of the 18 objects is a MetaFile. Each of the MetaFiles
contains 3425 polygons, this makes 61650 polygons. In contrast to Non-AA, all
polygons get painted when AAed since filled polygons with a sub-pixel size have
an influence (which is not the case in the non-AAed case). This is simply the
cost of AAing those polygons. There is not even a change in handling MetaFile
painting with the primitives, except that VCL now uses AA when switched on at
the OutputDevice.
To test, i switched off AA in tools/options/view and it's not really faster (so
AAing on WIN32 is really fast). I checked with a DEV300 m29 (without primitives)
and painting those objects is also very slow (no difference to 3.1 version), try
to zoom to check this.

AW->OD: The painting speed has not really changed at all (it's just incredible
objects), but the SW typing seems to use another rectangle to determine if it
overlaps those objects, there must be a change there. Please check in that
direction. Even when the objects scroll out of sight, the typing seems to force
them to be repainted.
Comment 9 Rainer Bielefeld 2009-04-14 15:06:51 UTC
@aw:
I checked your results and I think anti aliasing really is a big part of the
problem. after I switched it off, let a typing work approximately twice as fast
as with anti-aliasing. .3.1 still as very slow!
Even without anti-aliasing in a document of my own it causes 100% CPU load if I
type "k" and "m" alternating as fast as I can.  With 2.4.1 the same proceeding
does not cause any abnormal CPU load.
Comment 10 Rainer Bielefeld 2009-04-14 15:11:44 UTC
And the same result with "test_502.odt". When I switch of AA typing works much
faster, but very much more slowly than with 2.4.1.
Comment 11 Armin Le Grand 2009-04-14 15:16:57 UTC
AW->rainerbielefeld: Please read again: Problem is not AA per se, but that a
region (the grahics) is somehow invalidated which should not be touched when
typing below it. 3.0(.1) would be comparable slow in that case; force repaints
there with zooming (hold CTRL, use mouse wheel). BTW: When AA is off in 3.1,
there is NO difference in MetaFile playback between 3.1 and 3.0.1 at all.
Comment 12 Oliver-Rainer Wittmann 2009-04-14 16:45:52 UTC
I agree to AW that the root cause of this issue is not the Anti-Aliasing,
because Anti-Aliasing has been introduced after DEV300m30.

OD->AW:
For the check, if a certain Draw graphic object overlaps with the paint region,
the sequences of its 2D primitives is generated. These primitives are used to
determine the geometry of the Draw graphic object in order to compare it with
the paint region.
It seems the determination of their 2D primitives cost some time.
Do you know an optimization for this case?
Can the area taken by the Draw graphic object be determined less "expensive" for
this check?
Does it make sense to check, if the bounding rectangle overlaps with the paint
region, before determining the geometry of a Drawing object?
Comment 13 Armin Le Grand 2009-04-14 18:03:10 UTC
AW: Checked with using the locally buffered getObjectRange method in
ViewObjectContact::getPrimitive2DSequenceHierarchy. This works well, but i am
not sure about the caveats this will have. Still trying to find the reason why
the primitive gereration involved is thus expensive...
Comment 14 Armin Le Grand 2009-04-14 18:10:29 UTC
AW: Using VerySleepy shows that SdrGrafPrimitive2D::SdrGrafPrimitive2D uses
nearly 100% of the time by calling the GraphicObject constructor. This call
registers the object at the graphic manager, adds it to sume buffering and uses
ImpGraphic::ImplGetChecksum when doing this.
This is surprising since it's a copy constructor which may simply copy the
checksum, knowing that the object gets copied, not a new one created.
If this cannot be changed it will still be possible to use only one instance of
the GraphicObject, e.g. using a shared ptr.

Setting KA on copy.

AW->KA: Why is copy-constructing a GraphicObject thus expensive? Does it have to
re-calculate the involved checksums in a copy constructor...?
Comment 15 ooo 2009-04-15 09:47:36 UTC
KA=>AW: I'm currently  taking a look at the Copy Ctor, hoping to improve the
behaviour...
Comment 16 Armin Le Grand 2009-04-15 10:28:35 UTC
AW->KA: Adding code to GraphicObject::GraphicObject( const GraphicObject&
rGraphicObj, const GraphicManager* pMgr ) in grfmgr.cxx

    mpMgr = &rGraphicObj.GetGraphicManager();

directly before

    ImplSetGraphicManager( pMgr );

avoids the assignment and seems legal to me; the GraphicManager is known. This
solves the problem completely, no changes needed in graphic primitives. Is this
a possibility...?
Comment 17 Armin Le Grand 2009-04-15 10:50:50 UTC
AW: I took a look at GraphicObject usage for the whole chain through SdrGrafObj
and primitives. To change this to shared_ptr would mean to incompatible change
SdrGrafObj's member, the interface to get/set GraphicObject there and all users
(all apps, incompatible from svx). This would be possible, but highly dangerous.
It would be much better if GraphicObject copy constructor could manage to copy
it's registration at the GraphicsManager; the Graphic to use (checksum, etc...)
is all known - it's the copy constructor.
This change - if possible and not too dangerous - would also be potentially
useful for performance per se; i'm sure GraphicObject copy constructor is used
in quite some other cases, too.
Hoping for KA finding a good solution, looking forward for other possibilities...
Comment 18 Armin Le Grand 2009-04-15 15:08:57 UTC
AW: KA presented a good patch, we reviewed already and it solves the problem by
speeding up the GraphicObject copy constructor. Testing with various
presentations and stuff at KA and my side here.
Started to prepare AW071 CWS based on OOO310 m9...
Comment 19 Armin Le Grand 2009-04-15 15:55:08 UTC
AW: Small chnge to the patch after looking with KA, tested on WIN32 with the
bugdoc and 50-60 other documents. Looks like the load performance has increased,
too (feeled, not measured :-)). Added to CWS aw071, preparing versions...
Comment 20 Armin Le Grand 2009-04-15 16:02:47 UTC
AW: Changes committed, install sets building.
Comment 21 Armin Le Grand 2009-04-15 17:01:15 UTC
AW->WG: Please review. Just load the bugdoc and try typing where announced. Task
was for WIN32, but is the same on all plattforms.
Comment 22 wolframgarten 2009-04-17 10:00:26 UTC
Verified in CWS.
Comment 23 wolframgarten 2009-04-21 10:46:29 UTC
Closed.