Re: refactoring OUString

Mathias Bauer <[email protected]> Wed, 08 Jun 2011 00:03:05 +0200
Newsgroups gmane.comp.openoffice.devel.general
Message-ID <[email protected]>
On 07.06.2011 17:22, Niklas Nebel wrote:
> On 07.06.2011 13:15, tora - Takamichi Akiyama wrote:
>> As many already know, malloc() is too general and too expensive.
>> Moreover, free() is much more expensive than malloc().
>> e.g. a source code of malloc() in glibc:
>> http://sourceware.org/git/?p=glibc.git;a=blob;f=malloc/malloc.c
>
> We use our own implementation, rtl_allocateMemory (see
> sal/rtl/source/alloc*). But of course the point remains valid: Both
> allocation and deallocation take time.
>
>> Even though current OpenOffice.org runs as a multi-thread process,
>> it runs as if it is a single thread. So, we could have several options
>> to implement its underlying memory allocation mechanism for the specific
>> purposes of OpenOffice.org.
>
> If there was only a single thread, we could get rid of quite some
> locking overhead. But in fact, with clipboard, UNO acceptor thread and
> such stuff, we have just enough multithreading going on to cause the
> overhead, without the benefit of actually doing work in parallel.

Properly using a read-only string class (at least in code that might be 
accessed in multiple threads) could also prevent locking overhead.

Regards,
Mathias

-- 
Mathias Bauer (mba) - Project Lead OpenOffice.org Writer
OpenOffice.org Engineering at Oracle: http://blogs.sun.com/GullFOSS
Please don't reply to "[email protected]".
I use it for the OOo lists and only rarely read other mails sent to it.
-- 
-----------------------------------------------------------------
To unsubscribe send email to [email protected]
For additional commands send email to [email protected]
with Subject: help