r46885 - in /trunk/libdata-peek-perl: ChangeLog MANIFEST META.yml Peek.pm Peek.xs debian/changelog debian/control t/30_DDump-s.t t/52_DGrow.t

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Sat Nov 7 15:41:01 UTC 2009


Author: jawnsy-guest
Date: Sat Nov  7 15:40:54 2009
New Revision: 46885

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=46885
Log:
* New upstream release
* Standards-Version 3.8.3 (no changes)

Added:
    trunk/libdata-peek-perl/t/52_DGrow.t
      - copied unchanged from r46884, branches/upstream/libdata-peek-perl/current/t/52_DGrow.t
Modified:
    trunk/libdata-peek-perl/ChangeLog
    trunk/libdata-peek-perl/MANIFEST
    trunk/libdata-peek-perl/META.yml
    trunk/libdata-peek-perl/Peek.pm
    trunk/libdata-peek-perl/Peek.xs
    trunk/libdata-peek-perl/debian/changelog
    trunk/libdata-peek-perl/debian/control
    trunk/libdata-peek-perl/t/30_DDump-s.t

Modified: trunk/libdata-peek-perl/ChangeLog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-peek-perl/ChangeLog?rev=46885&op=diff
==============================================================================
--- trunk/libdata-peek-perl/ChangeLog (original)
+++ trunk/libdata-peek-perl/ChangeLog Sat Nov  7 15:40:54 2009
@@ -1,3 +1,8 @@
+2009-11-06 0.28 - H.Merijn Brand   <h.m.brand at xs4all.nl>
+
+    * DDump () now dumps the variable itself, instead of a copy (Zefram)
+    * Add DGrow ()
+
 2009-06-03 0.27 - H.Merijn Brand   <h.m.brand at xs4all.nl>
 
     * void context behaviour for DPeek ()

Modified: trunk/libdata-peek-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-peek-perl/MANIFEST?rev=46885&op=diff
==============================================================================
--- trunk/libdata-peek-perl/MANIFEST (original)
+++ trunk/libdata-peek-perl/MANIFEST Sat Nov  7 15:40:54 2009
@@ -17,5 +17,6 @@
 t/41_DDump-h.t		Tests for DDump () returning hash   using _IO
 t/50_DDual.t		Tests for DDual ()
 t/51_triplevar.t	Tests for triplevar ()
+t/52_DGrow.t		Tests for DGrow ()
 examples/ddumper.pl	show the use
 META.yml                                 Module meta-data (added by MakeMaker)

Modified: trunk/libdata-peek-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-peek-perl/META.yml?rev=46885&op=diff
==============================================================================
--- trunk/libdata-peek-perl/META.yml (original)
+++ trunk/libdata-peek-perl/META.yml Sat Nov  7 15:40:54 2009
@@ -1,6 +1,6 @@
 --- #YAML:1.1
 name:                    Data::Peek
-version:                 0.27
+version:                 0.28
 abstract:                Modified and extended debugging facilities
 license:                 perl
 author:              
@@ -10,12 +10,12 @@
 provides:
     Data::Peek:
         file:            Peek.pm
-        version:         0.27
+        version:         0.28
 requires:     
     perl:                5.006
     DynaLoader:          0
 recommends:
-    perl:                5.008005
+    perl:                5.010001
 configure_requires:
     ExtUtils::MakeMaker: 0
 build_requires:

Modified: trunk/libdata-peek-perl/Peek.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-peek-perl/Peek.pm?rev=46885&op=diff
==============================================================================
--- trunk/libdata-peek-perl/Peek.pm (original)
+++ trunk/libdata-peek-perl/Peek.pm Sat Nov  7 15:40:54 2009
@@ -6,9 +6,9 @@
 use DynaLoader ();
 
 use vars qw( $VERSION @ISA @EXPORT @EXPORT_OK );
-$VERSION   = "0.27";
+$VERSION   = "0.28";
 @ISA       = qw( DynaLoader Exporter );
- at EXPORT    = qw( DDumper DDsort DPeek DDisplay DDump DDual );
+ at EXPORT    = qw( DDumper DDsort DPeek DDisplay DDump DDual DGrow );
 @EXPORT_OK = qw( triplevar );
 $] >= 5.007003 and push @EXPORT, "DDump_IO";
 
@@ -92,16 +92,16 @@
 
 sub _DDump_ref
 {
-    my ($var, $down) = (@_, 0);
-
-    my $ref = ref $var;
+    my (undef, $down) = (@_, 0);
+
+    my $ref = ref $_[0];
     if ($ref eq "SCALAR" || $ref eq "REF") {
-	my %hash = DDump ($$var, $down);
+	my %hash = DDump (${$_[0]}, $down);
 	return { %hash };
 	}
     if ($ref eq "ARRAY") {
 	my @list;
-	foreach my $list (@$var) {
+	foreach my $list (@{$_[0]}) {
 	    my %hash = DDump ($list, $down);
 	    push @list, { %hash };
 	    }
@@ -109,8 +109,8 @@
 	}
     if ($ref eq "HASH") {
 	my %hash;
-	foreach my $key (sort keys %$var) {
-	    $hash{DPeek ($key)} = { DDump ($var->{$key}, $down) };
+	foreach my $key (sort keys %{$_[0]}) {
+	    $hash{DPeek ($key)} = { DDump ($_[0]->{$key}, $down) };
 	    }
 	return { %hash };
 	}
@@ -119,16 +119,16 @@
 
 sub _DDump
 {
-    my ($var, $down, $dump, $fh) = (@_, "");
+    my (undef, $down, $dump, $fh) = (@_, "");
 
     if ($has_perlio and open $fh, ">", \$dump) {
 	#print STDERR "Using DDump_IO\n";
-	DDump_IO ($fh, $var, $down);
+	DDump_IO ($fh, $_[0], $down);
 	close $fh;
 	}
     else {
 	#print STDERR "Using DDump_XS\n";
-	$dump = DDump_XS ($var);
+	$dump = DDump_XS ($_[0]);
 	}
 
     return $dump;
@@ -136,8 +136,8 @@
 
 sub DDump ($;$)
 {
-    my ($var, $down) = (@_, 0);
-    my @dump = split m/[\r\n]+/, _DDump ($var, wantarray || $down) or return;
+    my (undef, $down) = (@_, 0);
+    my @dump = split m/[\r\n]+/, _DDump ($_[0], wantarray || $down) or return;
 
     if (wantarray) {
 	my %hash;
@@ -149,8 +149,8 @@
 	    $hash{FLAGS} = { map { $_ => 1 } split m/,/ => $hash{FLAGS} };
 	    }
 
-	$down && ref $var and
-	    $hash{RV} = _DDump_ref ($var, $down - 1) || $var;
+	$down && ref $_[0] and
+	    $hash{RV} = _DDump_ref ($_[0], $down - 1) || $_[0];
 	return %hash;
 	}
 
@@ -192,7 +192,8 @@
  close $fh;
  print $dump;
 
- use Data::Peek qw( triplevar );
+ use Data::Peek qw( DGrow triplevar );
+ my $x = ""; DGrow ($x, 10000);
  my $tv = triplevar ("\N{GREEK SMALL LETTER PI}", 3, "3.1415");
 
 =head1 DESCRIPTION
@@ -321,6 +322,24 @@
       "  RV: ", DPeek ($d[3]), "\n";
     }
   
+=head2 my $LEN = DGrow ($pv, $size)
+
+Fastest way to preallocate space for a PV scalar. Returns the allocated
+length. If $size is smaller than the already allocated space, it will
+not shrink.
+
+ cmpthese (-2, {
+     pack => q{my $x = ""; $x = pack "x20000"; $x = "";},
+     op_x => q{my $x = ""; $x = "x"  x 20000;  $x = "";},
+     grow => q{my $x = ""; DGrow ($x,  20000); $x = "";},
+     });
+
+           Rate  op_x  pack  grow
+ op_x   62127/s    --  -59%  -96%
+ pack  152046/s  145%    --  -91%
+ grow 1622943/s 2512%  967%    --
+
+
 =head2 triplevar ($pv, $iv, $nv)
 
 When making C<DDual ()> I wondered if it were possible to create triple-val

Modified: trunk/libdata-peek-perl/Peek.xs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-peek-perl/Peek.xs?rev=46885&op=diff
==============================================================================
--- trunk/libdata-peek-perl/Peek.xs (original)
+++ trunk/libdata-peek-perl/Peek.xs Sat Nov  7 15:40:54 2009
@@ -163,6 +163,21 @@
     /* XS DDual */
 
 void
+DGrow (sv, size)
+    SV     *sv
+    IV      size
+
+  PROTOTYPE: $$
+  PPCODE:
+    if (SvROK (sv))
+	sv = SvRV (sv);
+    if (!SvPOK (sv))
+	sv_setpvn (sv, "", 0);
+    SvGROW (sv, size);
+    mPUSHi (SvLEN (sv));
+    /* XS DGrow */
+
+void
 DDump_XS (sv)
     SV   *sv
 

Modified: trunk/libdata-peek-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-peek-perl/debian/changelog?rev=46885&op=diff
==============================================================================
--- trunk/libdata-peek-perl/debian/changelog (original)
+++ trunk/libdata-peek-perl/debian/changelog Sat Nov  7 15:40:54 2009
@@ -1,4 +1,8 @@
-libdata-peek-perl (0.27-2) UNRELEASED; urgency=low
+libdata-peek-perl (0.28-1) UNRELEASED; urgency=low
+
+  [ Jonathan Yu ]
+  * New upstream release
+  * Standards-Version 3.8.3 (no changes)
 
   [ Nathan Handler ]
   * debian/watch: Update to ignore development releases.
@@ -11,7 +15,7 @@
   [ Ryan Niebur ]
   * Update jawnsy's email address
 
- -- Ryan Niebur <ryanryan52 at gmail.com>  Tue, 01 Sep 2009 21:18:29 -0700
+ -- Jonathan Yu <jawnsy at cpan.org>  Sat, 07 Nov 2009 07:06:29 -0500
 
 libdata-peek-perl (0.27-1) unstable; urgency=low
 

Modified: trunk/libdata-peek-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-peek-perl/debian/control?rev=46885&op=diff
==============================================================================
--- trunk/libdata-peek-perl/debian/control (original)
+++ trunk/libdata-peek-perl/debian/control Sat Nov  7 15:40:54 2009
@@ -6,7 +6,7 @@
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
 Uploaders: Jeremiah C. Foster <jeremiah at jeremiahfoster.com>,
  Jonathan Yu <jawnsy at cpan.org>
-Standards-Version: 3.8.1
+Standards-Version: 3.8.3
 Homepage: http://search.cpan.org/dist/Data-Peek/
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libdata-peek-perl/
 Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libdata-peek-perl/

Modified: trunk/libdata-peek-perl/t/30_DDump-s.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-peek-perl/t/30_DDump-s.t?rev=46885&op=diff
==============================================================================
--- trunk/libdata-peek-perl/t/30_DDump-s.t (original)
+++ trunk/libdata-peek-perl/t/30_DDump-s.t Sat Nov  7 15:40:54 2009
@@ -65,7 +65,9 @@
 SV = PV(0x****) at 0x****
   REFCNT = 1
   FLAGS = (PADMY)
-  PV = 0
+  PV = 0x**** ""\0
+  CUR = 0
+  LEN = 8
 ==
 0
 --
@@ -73,7 +75,9 @@
   REFCNT = 1
   FLAGS = (PADMY,IOK,pIOK)
   IV = 0
-  PV = 0
+  PV = 0x**** ""\0
+  CUR = 0
+  LEN = 8
 ==
 1
 --
@@ -81,7 +85,9 @@
   REFCNT = 1
   FLAGS = (PADMY,IOK,pIOK)
   IV = 1
-  PV = 0
+  PV = 0x**** ""\0
+  CUR = 0
+  LEN = 8
 ==
 ""
 --




More information about the Pkg-perl-cvs-commits mailing list