From: Dagfinn Ilmari Mannsåker Date: Tue, 29 Mar 2016 12:10:39 +0000 (+0100) Subject: Remove confusing code introduced in 8fc4291e X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2d5ac3cf038f571d61c422abadc11ef2779b2b0a;p=dbsrgits%2FDBIx-Class-Historic.git Remove confusing code introduced in 8fc4291e but why is $dump_str declared outside dump_value? ilmari: silly minimalistic microoptimization (not to reclear the dump every time it's needed) ilmari: my $foo { reuse $foo many time in this scope } *minimally faster* than { use my $foo_to_be_cleared_any_time_we_leave_scope } less for the scope unwinder to do as I said - it's silly, and 100% undetectable is dump_value that hot? it's not hot at all we've probably wasted more time discussing this now than the total CPU time saved by that micro-optimisation, over the entire future lifetime of DBIC ilmari: well, my 1st sentence today was admitting exactly that ;) I have been working on the rowparser for 5 days, the mindset is different, and it "bleeds through" --- diff --git a/lib/DBIx/Class/_Util.pm b/lib/DBIx/Class/_Util.pm index 60a4815..f07dff6 100644 --- a/lib/DBIx/Class/_Util.pm +++ b/lib/DBIx/Class/_Util.pm @@ -121,12 +121,12 @@ sub serialize ($) { nfreeze($_[0]); } -my ($dd_obj, $dump_str); +my $dd_obj; sub dump_value ($) { local $Data::Dumper::Indent = 1 unless defined $Data::Dumper::Indent; - $dump_str = ( + my $dump_str = ( $dd_obj ||= do {