develooper Front page | perl.moose | Postings from October 2010

Overhead of using MooseX::Declare

Thread Next
From:
Shlomi Fish
Date:
October 19, 2010 10:30
Subject:
Overhead of using MooseX::Declare
Message ID:
201010191930.42193.shlomif@iglu.org.il
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 .

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About