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

Re: Overhead of using MooseX::Declare

Thread Previous | Thread Next
From:
Shlomi Fish
Date:
October 20, 2010 04:07
Subject:
Re: Overhead of using MooseX::Declare
Message ID:
201010201307.37409.shlomif@iglu.org.il
On Tuesday 19 October 2010 23:31:31 Evan Carroll wrote:
> I'm sorry, where is the benchmark? 

Here you go:

{{{{{{{{{{{{{{{{{{{{
shlomif:~/Download/unpack/perl/cpan/cprops-perl/cprops-perl/CProps-Trie$ git 
status
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#	best-out-of-three.txt
nothing added to commit but untracked files present (use "git add" to track)
shlomif:~/Download/unpack/perl/cpan/cprops-perl/cprops-perl/CProps-Trie$ less 
best-out-of-three.txt 
shlomif:~/Download/unpack/perl/cpan/cprops-perl/cprops-perl/CProps-Trie$ ls
best-out-of-three.txt  lib          Makefile.PL~   META.yml    t        Trie.o
blib                   Makefile     MANIFEST       pm_to_blib  Trie.bs  
Trie.xs
Changes                Makefile.PL  MANIFEST.SKIP  README      Trie.c   
typemap
shlomif:~/Download/unpack/perl/cpan/cprops-perl/cprops-perl/CProps-Trie$ git 
status
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#	best-out-of-three.txt
nothing added to commit but untracked files present (use "git add" to track)
shlomif:~/Download/unpack/perl/cpan/cprops-perl/cprops-perl/CProps-Trie$ make
Manifying blib/man3/CProps::Trie.3pm
shlomif:~/Download/unpack/perl/cpan/cprops-perl/cprops-perl/CProps-Trie$ 
export ^CBCPROPS_LIBDIR=/home/shlomif/apps/cprops/lib/ 
LIBCPROPS_INCDIR=/home/shlomif/apps/cprops/include/
shlomif:~/Download/unpack/perl/cpan/cprops-perl/cprops-perl/CProps-Trie$ ls
best-out-of-three.txt  lib          Makefile.PL~   META.yml    t        Trie.o
blib                   Makefile     MANIFEST       pm_to_blib  Trie.bs  
Trie.xs
Changes                Makefile.PL  MANIFEST.SKIP  README      Trie.c   
typemap
shlomif:~/Download/unpack/perl/cpan/cprops-perl/cprops-perl/CProps-Trie$ 
sudo_renice make test
Password: 
PERL_DL_NONLAZY=1 /usr/bin/perl5.12.2 "-MExtUtils::Command::MM" "-e" 
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/001-load.t .......... ok   
t/002-insertions.t .... ok   
t/003-removal.t ....... ok   
t/004-searches.t ...... ok   
t/005-free-ref-bug.t .. ok   
t/006-stresstest.t .... ok   
t/007-memleaks.t ...... ok   
t/008-kwalitee.t ...... skipped: Test::Kwalitee not installed; skipping
t/009-pod.t ........... ok   
t/010-pod-coverage.t .. ok   
t/099-perl-critic.t ... skipped: Author test.  Set $ENV{TEST_AUTHOR} to a true 
value to run.
All tests successful.
Files=11, Tests=31, 44 wallclock secs ( 0.22 usr  0.05 sys + 39.28 cusr  1.48 
csys = 41.03 CPU)
Result: PASS
shlomif:~/Download/unpack/perl/cpan/cprops-perl/cprops-perl/CProps-Trie$ git 
checkout convert_away_from_moosex_declare
Switched to branch 'convert_away_from_moosex_declare'
shlomif:~/Download/unpack/perl/cpan/cprops-perl/cprops-perl/CProps-Trie$ make
Makefile out-of-date with respect to Makefile.PL
Cleaning current config before rebuilding Makefile...
make -f Makefile.old clean > /dev/null 2>&1
/usr/bin/perl5.12.2 Makefile.PL 
ERROR: Can't find cprops/collection.h header.

If the library is not installed, you will need to install it. If it is
installed somewhere other than /usr or /usr/local, you need to set the
following environment variables:

    LIBCPROPS_LIBDIR should contain the path to the libcprops libraries
    LIBCPROPS_INCDIR should contain the path to the libcprops include files

make: *** [Makefile] Error 2
shlomif:~/Download/unpack/perl/cpan/cprops-perl/cprops-perl/CProps-Trie$ 
export LIBCPROPS_LIBDIR=/home/shlomif/apps/cprops/lib/ 
LIBCPROPS_INCDIR=/home/shlomif/apps/cprops/include/
shlomif:~/Download/unpack/perl/cpan/cprops-perl/cprops-perl/CProps-Trie$ make
make: *** No targets specified and no makefile found.  Stop.
shlomif:~/Download/unpack/perl/cpan/cprops-perl/cprops-perl/CProps-Trie$ perl 
Makefile.PL
Library location is: -L/home/shlomif/apps/cprops/lib/ -lcprops
Header location is: -I/home/shlomif/apps/cprops/include//cprops
Checking if your kit is complete...
Looks good
Writing Makefile for CProps::Trie
shlomif:~/Download/unpack/perl/cpan/cprops-perl/cprops-perl/CProps-Trie$ make
cp lib/CProps/Trie.pm blib/lib/CProps/Trie.pm
/usr/bin/perl5.12.2 /usr/lib/perl5/5.12.2/ExtUtils/xsubpp  -typemap 
/usr/lib/perl5/5.12.2/ExtUtils/typemap -typemap typemap  Trie.xs > Trie.xsc && 
mv Trie.xsc Trie.c
i586-mandriva-linux-gnu-gcc -c  -I/home/shlomif/apps/cprops/include//cprops -
D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -
I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -
Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --
param=ssp-buffer-size=4 -fomit-frame-pointer -march=i586 -mtune=generic -
fasynchronous-unwind-tables   -DVERSION=\"0.01\" -DXS_VERSION=\"0.01\" -fPIC 
"-I/usr/lib/perl5/5.12.2/i386-linux-thread-multi/CORE"   Trie.c
Running Mkbootstrap for CProps::Trie ()
chmod 644 Trie.bs
rm -f blib/arch/auto/CProps/Trie/Trie.so
LD_RUN_PATH="/home/shlomif/apps/cprops/lib" i586-mandriva-linux-gnu-gcc  -
shared -O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -
fstack-protector --param=ssp-buffer-size=4 -fomit-frame-pointer -march=i586 -
mtune=generic -fasynchronous-unwind-tables -L/usr/local/lib Trie.o  -o 
blib/arch/auto/CProps/Trie/Trie.so 	\
   -L/home/shlomif/apps/cprops/lib/ -lcprops  	\
  
chmod 755 blib/arch/auto/CProps/Trie/Trie.so
cp Trie.bs blib/arch/auto/CProps/Trie/Trie.bs
chmod 644 blib/arch/auto/CProps/Trie/Trie.bs
Manifying blib/man3/CProps::Trie.3pm
shlomif:~/Download/unpack/perl/cpan/cprops-perl/cprops-perl/CProps-Trie$ 
sudo_renice make test
PERL_DL_NONLAZY=1 /usr/bin/perl5.12.2 "-MExtUtils::Command::MM" "-e" 
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/001-load.t .......... ok   
t/002-insertions.t .... ok   
t/003-removal.t ....... ok   
t/004-searches.t ...... ok   
t/005-free-ref-bug.t .. ok   
t/006-stresstest.t .... ok   
t/007-memleaks.t ...... ok   
t/008-kwalitee.t ...... skipped: Test::Kwalitee not installed; skipping
t/009-pod.t ........... ok   
t/010-pod-coverage.t .. ok   
t/099-perl-critic.t ... skipped: Author test.  Set $ENV{TEST_AUTHOR} to a true 
value to run.
All tests successful.
Files=11, Tests=31,  3 wallclock secs ( 0.22 usr  0.04 sys +  1.90 cusr  0.23 
csys =  2.39 CPU)
Result: PASS
shlomif:~/Download/unpack/perl/cpan/cprops-perl/cprops-perl/CProps-Trie$ 
sudo_renice make test
PERL_DL_NONLAZY=1 /usr/bin/perl5.12.2 "-MExtUtils::Command::MM" "-e" 
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/001-load.t .......... ok   
t/002-insertions.t .... ok   
t/003-removal.t ....... ok   
t/004-searches.t ...... ok   
t/005-free-ref-bug.t .. ok   
t/006-stresstest.t .... ok   
t/007-memleaks.t ...... ok   
t/008-kwalitee.t ...... skipped: Test::Kwalitee not installed; skipping
t/009-pod.t ........... ok   
t/010-pod-coverage.t .. ok   
t/099-perl-critic.t ... skipped: Author test.  Set $ENV{TEST_AUTHOR} to a true 
value to run.
All tests successful.
Files=11, Tests=31,  3 wallclock secs ( 0.22 usr  0.05 sys +  1.92 cusr  0.22 
csys =  2.41 CPU)
Result: PASS
shlomif:~/Download/unpack/perl/cpan/cprops-perl/cprops-perl/CProps-Trie$ 

}}}}}}}}}}}}}}}}}}}}

So running "make test" with the .pm being MooseX::Declare takes 44 wallclock 
seconds (after sudo'ed to the highest priority), and the make test after the 
converting the code to use Class-XSAccessor takes 3 wallclock seconds. I 
should note that I've achieved better results for both runs (about 22 seconds 
and 1.5 seconds respectively) when running it on IceWM, and now I'm running it 
on top of GNOME and compiz with many apps running.

> Does it use the type system?
> Coercions? Method signatures? I didn't see it in the attached links
> and I feel without it this is a rather bad post... 

You can look at the code in the URL I've given:

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

see lib/CProps/Trie.pm .

> Does your use of
> the term "run" include startup costs? Or, is this a runtime benchmark?

It does include startup costs and I expect them to be the most wasteful here. 
I'm timing running the eleven test scripts of the distribution using "make 
test".

Regards,

	Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Parody of "The Fountainhead" - http://shlom.in/towtf

<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 Previous | 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