Re: Build light weight conversion binary

2012-07-20 Thread Riccardo Magliocchetti

Hello,

Il 20/07/2012 07:26, Jerry Tan ha scritto:

Hi,

The company that I work for use LibreOffice as the main word processor. We 
convert a lot of client letters from doc/docx to open document format.
We are on Mac OS X Lion (10.7) btw.
We use: soffice --headless --convert-to odt ….  to do the batch conversion.

The problems with this are:
- It takes quite a long time to start up. It becomes a problem when we have to 
convert many documents.


You can try to look at using UNO wrappers like unoconv so you can keep 
your libo instance running all the time to avoid startup time costs:


https://github.com/dagwieers/unoconv

There's a long thread in this issue regarding unoconv on MacOS X
https://github.com/dagwieers/unoconv/issues/27

hth,
riccardo
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Build light weight conversion binary

2012-07-20 Thread Riccardo Magliocchetti

Jerry, Michael,

Il 20/07/2012 18:04, Michael Stahl ha scritto:

On Thu, 2012-07-19 at 22:26 -0700, Jerry Tan wrote:



So my boss asked me to fix these 2 issues. I managed to build the
source code on Mac OS X Lion and then try to see what's going on
(unfortunately specifying --headless fail to build).


do you mean the configure "--enable-headless" option?  that is very
experimental and know to build only on the system of the guy who added it :)


Last time i checked the 3.6 branch it was building fine for linux, can 
you share any details on the configuration that is failing?


thanks,
riccardo
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Build light weight conversion binary

2012-07-20 Thread Michael Stahl
On 20/07/12 17:25, Michael Meeks wrote:
> On Thu, 2012-07-19 at 22:26 -0700, Jerry Tan wrote:
>> The company that I work for use LibreOffice as the main word
>> processor. We convert a lot of client letters from doc/docx to open
>> document format.

>> - It won't work if there is already a LibreOffice instance running
> 
>   That should be easy enough to fix; it's a matter of not checking the
> OSL_PIPE that we setup to send arguments to the main process. It is
> possible that --nolockcheck does that, or perhaps there is a hidden
> argument for that.

there is no need to fix anything, just set up a separate user profile
directory for your batch conversions and start soffice like this:

 soffice -env:UserInstallation=file:///tmp/lo_userdir_conversions


>> So my boss asked me to fix these 2 issues. I managed to build the
>> source code on Mac OS X Lion and then try to see what's going on
>> (unfortunately specifying --headless fail to build).

do you mean the configure "--enable-headless" option?  that is very
experimental and know to build only on the system of the guy who added it :)

>   So - --headless doesn't work well for Mac, there is a need for some
> work there to fix it. There are really two different approaches - one is
> to re-factor the font code so it is re-usable without setting up the
> display / head logic, the other is to build & use freetype on mac, and
> re-use the Linux code for font rendering etc.

yes the --headless option in soffice, which currently works only on X11,
could in theory be made to work on Mac as well (and is _completely_
independent of the configure --enable-headless option).

>> - build a bare minimum/small binary (without too many dependencies)
>> just for conversion to odt? also how do I link statically?
>>   The conversion utility doesn't need all the gui libraries I believe.
>> Minimum dependency will make start up a lot quicker.
> 
>   So - those fragmented libraries help you there - the UI pieces
> shouldn't be linked on startup.

indeed that's why there are various *ui libraries, they contain dialogs
that aren't loaded when you just convert documents.

>> - what to do to allow conversion working while there is an instance of
>> LibreOffice already running? Should I modify something in the source
>> code?

that's completely unnecessary, as i wrote above.

you can't start 2 soffice with the same user profile, and trying to make
that work is probably quite a large effort and would probably slow down
things with file locking and such if it can be made to work at all.
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Build light weight conversion binary

2012-07-20 Thread Michael Meeks
Hi Jerry,

On Thu, 2012-07-19 at 22:26 -0700, Jerry Tan wrote:
> The company that I work for use LibreOffice as the main word
> processor. We convert a lot of client letters from doc/docx to open
> document format.

Sounds like a good use-case :-)

> We are on Mac OS X Lion (10.7) btw. We use: soffice --headless
> --convert-to odt ….  to do the batch conversion. 

Seems sensible.

> The problems with this are:
> - It takes quite a long time to start up. It becomes a problem when we
> have to convert many documents.

This is a matter of profiling; when you say "quite a long time" - how
long are you talking ? :-) Also, is your concern cold or warm startup
time ?

> - It won't work if there is already a LibreOffice instance running

That should be easy enough to fix; it's a matter of not checking the
OSL_PIPE that we setup to send arguments to the main process. It is
possible that --nolockcheck does that, or perhaps there is a hidden
argument for that.

> So my boss asked me to fix these 2 issues. I managed to build the
> source code on Mac OS X Lion and then try to see what's going on
> (unfortunately specifying --headless fail to build).

So - --headless doesn't work well for Mac, there is a need for some
work there to fix it. There are really two different approaches - one is
to re-factor the font code so it is re-usable without setting up the
display / head logic, the other is to build & use freetype on mac, and
re-use the Linux code for font rendering etc.

There are also some nice sillies going on; last I looked there was some
considerable proportion of the time rendering a nice gradient background
to a bitmap view of the window you can't see when using --headless ;-) I
suspect just profiling and turning off a lot of that fluff would
accelerate things for you. But -always- profile before optimisting.
Callgrind-for-mac + KCachegrind on Linux would be a great pair of free
tools if you have nothing better.

> I found out that to just do the conversion, there are many dynamic
> libraries are loaded (so I guess this is why it takes a long time).

That's not obvious to me, and I've done lots of work on profiling. If
you want faster cold-start, you can try using the --enable-mergelib
build mode - that builds a ton of the code into a single, huge library -
it may help you: I'd be interested in some hard profiling results from
that.

> Trying to understand what's going on in the code is not a simple task
> to be honest. Can some one help or give me info on how to:

:-)

> - build a bare minimum/small binary (without too many dependencies)
> just for conversion to odt? also how do I link statically?
>   The conversion utility doesn't need all the gui libraries I believe.
> Minimum dependency will make start up a lot quicker.

So - those fragmented libraries help you there - the UI pieces
shouldn't be linked on startup.

> - what to do to allow conversion working while there is an instance of
> LibreOffice already running? Should I modify something in the source
> code?

That should be easyish cf. above. See
desktop/source/app/officeipcthread.cxx and thereabouts :-)

> I'm sure a lot of people would love to have this light weight
> conversion utility.

Thanks so much for jumping in !

Michael.

-- 
michael.me...@suse.com  <><, Pseudo Engineer, itinerant idiot

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Build light weight conversion binary

2012-07-20 Thread Jerry Tan
Hi,

The company that I work for use LibreOffice as the main word processor. We 
convert a lot of client letters from doc/docx to open document format.
We are on Mac OS X Lion (10.7) btw.
We use: soffice --headless --convert-to odt ….  to do the batch conversion. 

The problems with this are:
- It takes quite a long time to start up. It becomes a problem when we have to 
convert many documents.
- It won't work if there is already a LibreOffice instance running

So my boss asked me to fix these 2 issues. I managed to build the source code 
on Mac OS X Lion and then try to see what's going on (unfortunately specifying 
--headless fail to build).
I found out that to just do the conversion, there are many dynamic libraries 
are loaded (so I guess this is why it takes a long time).
Trying to understand what's going on in the code is not a simple task to be 
honest.
Can some one help or give me info on how to:

- build a bare minimum/small binary (without too many dependencies) just for 
conversion to odt? also how do I link statically?
  The conversion utility doesn't need all the gui libraries I believe. Minimum 
dependency will make start up a lot quicker.
- what to do to allow conversion working while there is an instance of 
LibreOffice already running? Should I modify something in the source code?

I'm sure a lot of people would love to have this light weight conversion 
utility.
Many thanks before.

Jerry___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice