From: Peter Rabbitson Date: Wed, 13 Feb 2013 14:41:31 +0000 (+0100) Subject: memoize tryout (preliminary *NON-PRODUCTION!* hack) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ea98e8885c696cd1738d126f93f3e40cfd97d991;p=dbsrgits%2FDBIx-Class-Historic.git memoize tryout (preliminary *NON-PRODUCTION!* hack) --- diff --git a/lib/DBIx/Class/ResultSource/RowParser.pm b/lib/DBIx/Class/ResultSource/RowParser.pm index 8f4a317..ad6a073 100644 --- a/lib/DBIx/Class/ResultSource/RowParser.pm +++ b/lib/DBIx/Class/ResultSource/RowParser.pm @@ -92,6 +92,17 @@ sub _resolve_prefetch { # In any case - the output of this thing is meticulously micro-tested, so # any sort of adjustment/rewrite should be relatively easy (fsvo relatively) # + +# tryout an *exceedingly* naive memoizer (not much gain in preliminary benchmarks ...) +# +use Memoize 'memoize'; +use Storable 'nfreeze'; +use Sub::Name 'subname'; +memoize('_mk_row_parser', + NORMALIZER => sub { ref($_[0]) .nfreeze ($_[1]) }, +); +subname ( _mk_row_parser => \&_mk_row_parser ); + sub _mk_row_parser { # $args and $attrs are separated to delineate what is core collapser stuff and # what is dbic $rs specific