From 22c5a959dd5df5c8e555986bdab37973c560e1c3 Mon Sep 17 00:00:00 2001 From: "H.Merijn Brand" Date: Fri, 6 Nov 2009 23:10:47 +0100 Subject: [PATCH] Document speed diff --- Peek.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Peek.pm b/Peek.pm index a523b1d..7d47d06 100644 --- a/Peek.pm +++ b/Peek.pm @@ -328,6 +328,18 @@ 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 I wondered if it were possible to create triple-val -- 2.11.4.GIT