[Israel.pm] Fwd: Overhead of using MooseX::Declare

Shlomi Fish shlomif at iglu.org.il
Tue Oct 19 10:38:07 PDT 2010


----------  Forwarded Message  ----------

Subject: Overhead of using MooseX::Declare
Date: Tuesday 19 October 2010, 19:30:41
From: Shlomi Fish <shlomif at iglu.org.il>
To: moose at perl.org
CC: Tom Feist <shabble at metavore.org>

Hi all,

Tom (shabble, CCed to this message) has written CProps-Trie which provides 
Perl bindings to libcprops' trie implementation (a.k.a as a "prefix tree"): 

http://en.wikipedia.org/wiki/Trie

Now, I helped him debug some problems with initial versions of the code which 
can be found here:

http://github.com/shabble/cprops-perl

After that the code worked for me, but I noticed that the tests took a long 
time to run and apparently to load as well. From looking at lib/CProps/Trie.pm 
I noticed that it was written using MooseX::Declare. I decided to see if 
converting the code away from MooseX::Declare will make the tests run faster.

Today I finally found some tuits to do that, and converted it:

http://github.com/shlomif/cprops-perl/tree/convert_away_from_moosex_declare

The results are:

1. It took the tests with the original MooseX-Declare code 28 seconds to run 
on my Pentium 4 2.4 GHz machine (which is admittedly kinda old).

2. On the same machine, after converting the .pm file from MooseX-Declare to 
Class-XSAccessor, it took the tests 2 seconds or so to run, about 14 times 
faster (!). Furthermore, I still have some idea for some small optimisations.

Granted, I didn't benchmark both tests under renice and it's not a very 
accurate measurement. I'll get to it soon. Still it indicates that MX::Declare 
incurs a huge overhead. Seems like all the speed of the XS binding is lost 
there.

Regards,

	Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
http://www.shlomifish.org/humour/ways_to_do_it.html

<rindolf> She's a hot chick. But she smokes.
<go|dfish> She can smoke as long as she's smokin'.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

-----------------------------------------
-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Escape from GNU Autohell - http://www.shlomifish.org/open-
source/anti/autohell/

<rindolf> She's a hot chick. But she smokes.
<go|dfish> She can smoke as long as she's smokin'.

Please reply to list if it's a mailing list post - http://shlom.in/reply .


More information about the Perl mailing list