kingpong/perl-PDF-WebKit — pull request #1 by keithbro (2014-06-15 05:47:55+00:00)
Title: Improve performance by using Moo instead of Moose

Hi Philip

Thanks for open sourcing this module - I'm finding it very useful in a current project.

How would you feel about using Moo instead of Moose? I've run some tests and it appears to run a bit faster. My project will run PDF::WebKit inside a Mojo app so the performance improvement would be useful.

I'm not sure of the best way to quantify the improvement but here are the outputs of 5 runs of the test suite with Moose vs with Moo:

With Moose:

$ prove -Mlocal::lib=local -l
t/pdf-webkit-integration.t .. ok
t/pdf-webkit-source.t ....... ok
t/pdf-webkit.t .............. ok
All tests successful.
Files=3, Tests=45, 2 wallclock secs ( 0.03 usr 0.00 sys + 0.91 cusr 0.16 csys = 1.10 CPU)
Result: PASS

Files=3, Tests=45, 2 wallclock secs ( 0.03 usr 0.00 sys + 0.92 cusr 0.17 csys = 1.12 CPU)
Files=3, Tests=45, 2 wallclock secs ( 0.03 usr 0.00 sys + 0.92 cusr 0.16 csys = 1.11 CPU)
Files=3, Tests=45, 2 wallclock secs ( 0.03 usr 0.01 sys + 0.91 cusr 0.16 csys = 1.11 CPU)
Files=3, Tests=45, 2 wallclock secs ( 0.03 usr 0.01 sys + 0.99 cusr 0.18 csys = 1.21 CPU)

With Moo:

$ prove -Mlocal::lib=local -l
t/pdf-webkit-integration.t .. ok
t/pdf-webkit-source.t ....... ok
t/pdf-webkit.t .............. ok
All tests successful.
Files=3, Tests=45, 2 wallclock secs ( 0.03 usr 0.01 sys + 0.55 cusr 0.12 csys = 0.71 CPU)
Result: PASS

Files=3, Tests=45, 2 wallclock secs ( 0.03 usr 0.00 sys + 0.49 cusr 0.11 csys = 0.63 CPU)
Files=3, Tests=45, 2 wallclock secs ( 0.03 usr 0.01 sys + 0.51 cusr 0.12 csys = 0.67 CPU)
Files=3, Tests=45, 2 wallclock secs ( 0.03 usr 0.01 sys + 0.49 cusr 0.11 csys = 0.64 CPU)
Files=3, Tests=45, 2 wallclock secs ( 0.03 usr 0.01 sys + 0.51 cusr 0.12 csys = 0.67 CPU)

Please let me know your thoughts. Also note that I have replaced the "no Moose" lines with "use namespace::clean".

Thanks in advance,
Keith