Bug#849843: libyaml-libyaml-perl: [PATCH] lazy load B::Deparse for big speedup
Eric Wong
e at 80x24.org
Sun Jan 1 08:25:56 UTC 2017
Package: libyaml-libyaml-perl
Version: 0.63-1
Severity: normal
Tags: patch upstream
This speeds up startup time dramatically and is noticeable with
small scripts on my weak hardware where loading B::Deparse takes
a significant amount of time. Lazy loading it helps for the
common case when I do not need to dump a coderef.
"require" is idempotent in Perl, so it has virtually no overhead
across repeated invocations of coderef2text.
With this patch, the following script runs in around 30ms
without any args passed; and around 150ms with "code" as the
first arg. Without the patch, it takes around 150ms regardless.
-----------8<-----------
use YAML::XS qw(Dump);
my $h = { a => 'b', c => 'd' };
warn Dump($h);
if (shift eq 'code') {
warn $YAML::XS::coderef2text->(sub { print "Hi\n" });
}
-----------8<-----------
Note: I realize upstream has a git repository and bug tracker;
but I will not use that as that requires registering on a site
which is non-Free Software, requires non-Free JavaScript (which
I wouldn't run regardless given my slow hardware) and has an
unacceptable terms-of-service. So, thank you to Debian
for continuing to host an open-to-all bug tracker :)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-load-B-Deparse-lazily.patch
Type: text/x-diff
Size: 1660 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-perl-maintainers/attachments/20170101/16e35a46/attachment.patch>
More information about the pkg-perl-maintainers
mailing list