[Libreoffice] [PATCH] Accelerate perl installer: optimize installer::scriptitems::optimize_list().

Michael Meeks michael.meeks at novell.com
Thu Dec 2 04:39:44 PST 2010


Hi Alex,

On Thu, 2010-12-02 at 11:32 +0000, Alex Hudson wrote:
> (apologies for breaking the thread; I only just subscribed)

	Great to see you here :-)

> The more perlish version of optimize_list() would probably look more
> like this:

	Soo ...

> In general, doing a lot of text operations - like running regexes over a
> string that you later split anyway - will tend to slow things down a
> bit, although I would doubt any difference between my version and
> Jordan's would be amazingly significant unless the lists are quite long.

	One of the amazing things [ I think ] I discovered when last optimising
this beast, was that running a single regexp over the pre-parsed form
was really a lot faster than running it over lots of small post-parsed
strings; even if you compile the regexp. I assume this is down to the
overhead of allocation, multiple transitions into native-code etc.

	Of course, that was for some vast list / string / piece of parsed data
- so perhaps it has changed.

> I haven't looked at a huge amount of the installer, but it might be that
> internally using strings less and data structures more could be used to
> speed it up a fair bit: having a look around, there's a long of string
> building and stuff going on and it's not really clear that's usually a
> win.

	Right :-) and we seem to do a lot of duplication of lists as we build
them. AFAIR functions have a hard time syntactically operating on
pointers to lists and so tend to just return a list with the new item on
it, that then replaces the old one. Presumably some real perl guru could
do a -lot- better all over that code-base. I discovered some great
cut/paste coding there only yesterday.

> It might be worth dumping out some of the main datastructures from that
> cruft to actually see what's going on...

	Amen; and the idea of reading the code, and building a set of easy
hacks for people to work on is a great one; go for it ! :-) the more
easy hacks the better AFAICS - though profile before optimising of
course.

	Thanks !

		Michael.

-- 
 michael.meeks at novell.com  <><, Pseudo Engineer, itinerant idiot




More information about the LibreOffice mailing list