Issue 18883 - Printing through c++ bridge takes much longer then through COM/Basic
Summary: Printing through c++ bridge takes much longer then through COM/Basic
Status: CLOSED FIXED
Alias: None
Product: gsl
Classification: Code
Component: code (show other issues)
Version: OOo 1.1 RC3
Hardware: PC Windows 2000
: P2 Trivial (vote)
Target Milestone: OOo 1.1.1
Assignee: martho
QA Contact: issues@api
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-01 10:37 UTC by martho
Modified: 2004-09-27 11:20 UTC (History)
2 users (show)

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


Attachments
VC++-Project which prints through COM and through the Bridge (92.91 KB, application/octet-stream)
2003-09-01 10:39 UTC, martho
no flags Details
3-Page-Test-Document (Text, 2 Pics) (48.06 KB, application/octet-stream)
2003-09-01 10:40 UTC, martho
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description martho 2003-09-01 10:37:56 UTC
When trying to print a document throght the C++-bridge I found that the "print" 
will need to return some seconds. The blue bar indicating the print-progress is 
very much slower then when printing throught COM, Basic or directly with the 
print button from the user-interface.

I made a sample-project with VC++ 6.0 to show the difference. It has 2 buttons 
which just loads a document and then prints it - without any parameters or 
listeners or something. It displays a MessageBox how long it took the print to 
return. 

On my computer it's 0 seconds for the COM and 3 seconds for the Bridge to 
return from the print with the attached Test.swx. It seems to depend on the 
size of the document to be print, I got a more complex 3-page-document (with 
tables, pics and rows), which takes COM: 1 sec, Bridge: 37 sec.

Please change the pathes and files at the top of OOPrintTestDlg.cpp and in 
Debug/OOPrintTestDlg.ini to suite your environment.
Comment 1 martho 2003-09-01 10:39:05 UTC
Created attachment 8917 [details]
VC++-Project which prints through COM and through the Bridge
Comment 2 martho 2003-09-01 10:40:38 UTC
Created attachment 8918 [details]
3-Page-Test-Document (Text, 2 Pics)
Comment 3 ooo 2003-09-02 07:42:21 UTC
implementation issue
Comment 4 andreas.schluens 2003-09-30 08:10:03 UTC
AS->Daniel: Sorry - but I think you dont measure the time for printing
here. Your test measure the time, which is needed to call the remote
interface and return back from there. The implementation behind this
interface is everytimes the same, the printed document isnt changed =>
so the time needed for printing (which is done inside the remote
office proccess and not inside your client application) must be the
same. No data of the printing document are transfered due to the
bridge! And as you already know from #i14397#: calling of
XPrintable.print() without any special parameter starts the print job
as an asynchronous process ... and the interface call returns
immediatly after printing was started.

I suggest, that marshalling due to the C++ bridge is slower then due
to the COM bridge.

And further ... NO this bug isnt related to #i14397#! Because there
you describe the problem with an asynchronous print job in relation to
closing the document, which is a multithreading issue.

AS->DBO: I guess - its your ...
Comment 5 martho 2003-09-30 08:34:34 UTC
Hi Andreas,

thanx for your reply. You are right that I'm measuring the time 
between the call and the return of the call. But I have 2 arguments 
that it's not the call which makes the different:

1.) In general "early binding" (C++-Call) is faster then a "late 
binding" (COM-call). I've tested several other funtions where this is 
always true. So I think, a delay of 37 sec can't be explained as 
only "time for mashalling".

2.) The blue progress bar really is slower when the call is invoked 
from C++ then from COM. Because this could be only meassured 
subjectivly, I showed a view other people the progress bar - all of 
them said that the bar progresses much slower when the C++-call is 
used.

I, too, have to explanaition for this.
Comment 6 Daniel Boelzle [:dbo] 2003-09-30 15:48:05 UTC
@ssa: as commincated by kso to you...
Comment 7 Daniel Boelzle [:dbo] 2003-09-30 16:10:53 UTC
reassigned.
Comment 8 kai.sommerfeld 2003-09-30 16:23:59 UTC
KSO->SSA: Just investiagted a little into the problem. First, yes,
it's reproducable. The big difference is that when using COM the
print() UNO method gets always called from within the main thread of
the Office process and when using the URP (C++) bridge the method
always gets called from another thread (not-main). Looking at
vcl/win/source/app/slainst.cxx -> SalInstance::Yield() I found a
Sleep(1) in case we're not in the main thread. I removed this (only
for testing) and ... printing time did not differ anymore!
Comment 9 stephan_schaefer 2003-10-01 09:21:32 UTC
The sleep during yield which is called from a thread different to the
main thread was required to get rid of a dead lock that was triggered
by trying to switch to the busy main thread by sending a message. I'll
try to detect this situation and sleep only when the the main thread
is busy, this should cure the performance problem.
Comment 10 stephan_schaefer 2003-10-02 14:24:06 UTC
Changed target milestone.
Comment 11 stephan_schaefer 2003-10-22 11:53:35 UTC
The (time-consuming) sleep call is now only used when the deadlock
scenario is given, ie, when there is already a yielding dialog that
might block the main thread.

Comment 12 martho 2003-10-24 09:29:42 UTC
Thanx for the fast fixing!
Comment 13 stephan_schaefer 2003-11-13 15:49:33 UTC
ssa->kso: please verify.
Comment 14 kai.sommerfeld 2003-11-14 08:22:58 UTC
Looks good.
Comment 15 kai.sommerfeld 2003-11-14 08:23:35 UTC
... and VERIFIED.
Comment 16 kai.sommerfeld 2003-11-14 08:26:54 UTC
Martin, you should close this issue after verifiying that the fix
works for you in OOo 1.1.1
Comment 17 martho 2003-11-14 08:34:06 UTC
-> Ack
Comment 18 h.ilter 2003-12-16 12:32:22 UTC
Setting from KSO are not taken.
Comment 19 h.ilter 2003-12-16 12:32:56 UTC
Set to Verified.
Comment 20 Martin Hollmichel 2004-09-27 11:20:44 UTC
close issue.