Skip Menu |

This queue is for tickets about the Devel-REPL CPAN distribution.

Report information
The Basics
Id: 41523
Status: resolved
Priority: 0/
Queue: Devel-REPL

People
Owner: Nobody in particular
Requestors: DOY [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: outputting large classes with stringification overloads using the DDS plugin is quite slow
The DDS plugin uses Freezer to take care of classes with stringification overloads, but for whatever reason, this doesn't seem to keep the Data method from parsing through the entire data structure before just outputting the stringified version. This takes up to 30 seconds for some classes I'm using (and interrupting the print leaves me with corrupted objects, because of the way that DDS handles cycle detection). The attached patch skips using DDS altogether for classes with stringify overloads - it seems to work fine here (although it doesn't output the '$My_Class_1 = ' part that DDS does, but that doesn't particularly bother me).
Subject: stringify-overload.patch
Index: Plugin/DDS.pm =================================================================== --- Plugin/DDS.pm (revision 5228) +++ Plugin/DDS.pm (working copy) @@ -2,15 +2,16 @@ use Devel::REPL::Plugin; use Data::Dump::Streamer (); +use Scalar::Util 'blessed'; around 'format_result' => sub { my $orig = shift; my $self = shift; my $to_dump = (@_ > 1) ? [@_] : $_[0]; my $out; - if (ref $to_dump) { + # don't call DDS at all if we're just going to take the stringify overload + if (ref $to_dump && !(blessed $to_dump && $to_dump->can('(""'))) { my $dds = Data::Dump::Streamer->new; - $dds->Freezer(sub { "$_[0]"; }); $dds->Data($to_dump); $out = $dds->Out; } else {
Subject: Re: [rt.cpan.org #41523] outputting large classes with stringification overloads using the DDS plugin is quite slow
Date: Mon, 8 Dec 2008 17:47:42 +0000
To: Jesse Luehrs via RT <bug-Devel-REPL [...] rt.cpan.org>
From: Matt S Trout <mst [...] shadowcat.co.uk>
On Sun, Dec 07, 2008 at 08:58:27PM -0500, Jesse Luehrs via RT wrote: Show quoted text
> Sun Dec 07 20:58:24 2008: Request 41523 was acted upon. > Transaction: Ticket created by DOY > Queue: Devel-REPL > Subject: outputting large classes with stringification overloads using the > DDS plugin is quite slow > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: DOY@cpan.org > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=41523 > > > > The DDS plugin uses Freezer to take care of classes with stringification > overloads, but for whatever reason, this doesn't seem to keep the Data > method from parsing through the entire data structure before just > outputting the stringified version. This takes up to 30 seconds for some > classes I'm using (and interrupting the print leaves me with corrupted > objects, because of the way that DDS handles cycle detection). The > attached patch skips using DDS altogether for classes with stringify > overloads
And also removes the use of stringify so now objects further down won't be stringified, which is one of the reasons we wanted this. Would it not be better to submit a ticket to DDS to try and get that fixed? -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical Director http://www.shadowcat.co.uk/catalyst/ Shadowcat Systems Ltd. Want a managed development or deployment platform? http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/
As mst said, this is not our problem.