[libmoosex-has-sugar-perl] 02/11: Re bug #1 , Benchmarks show return is *faster* than no-return for some reason

Intrigeri intrigeri at moszumanska.debian.org
Wed Aug 27 21:35:37 UTC 2014


This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to annotated tag 1.000002-source
in repository libmoosex-has-sugar-perl.

commit 25603ed33d156a5ebe16212ff9ee0799f49c7311
Author: Kent Fredric <kentfredric at gmail.com>
Date:   Thu Jun 26 07:53:59 2014 +1200

    Re bug #1 , Benchmarks show return is *faster* than no-return for some reason
---
 benchmark/bench_return.pl | 59 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/benchmark/bench_return.pl b/benchmark/bench_return.pl
new file mode 100644
index 0000000..41a9562
--- /dev/null
+++ b/benchmark/bench_return.pl
@@ -0,0 +1,59 @@
+#!/usr/bin/env perl
+# FILENAME: bench_return.pl
+# CREATED: 06/26/14 07:41:05 by Kent Fredric (kentnl) <kentfredric at gmail.com>
+# ABSTRACT: Benchmark difference of return styles
+
+use strict;
+use warnings;
+use utf8;
+
+sub constant_return() {
+    return ( 'is', 'ro' );
+}
+
+sub constant_bare() {
+    ( 'is', 'ro' );
+}
+
+use Benchmark qw( :all :hireswallclock );
+
+cmpthese(
+    -2,
+    {
+        return  => sub { my $x = constant_return },
+        bare    => sub { my $x = constant_bare },
+        return2 => sub { my $x = constant_return },
+        bare2   => sub { my $x = constant_bare },
+    }
+);
+
+__END__
+5.21.1
+config_args='-de -Dusecbacktrace -Doptimize=-O3 -march=native -mtune=native -g -ggdb3 -Dusedevel -Accflags=-DUSE_C_BACKTRACE_ON_ERROR -Aldflags=-lbfd
+
+             Rate    bare   bare2 return2  return
+bare    3130035/s      --     -1%     -6%     -8%
+bare2   3171097/s      1%      --     -5%     -6%
+return2 3329940/s      6%      5%      --     -2%
+return  3389788/s      8%      7%      2%      --
+
+5.10.1
+config_args='-de'
+
+5.18.0
+config_args='-de'
+             Rate    bare   bare2  return return2
+bare    2929449/s      --     -3%     -7%     -9%
+bare2   3023864/s      3%      --     -4%     -6%
+return  3157930/s      8%      4%      --     -2%
+return2 3220760/s     10%      7%      2%      --
+
+
+5.12.5
+config_args='-de'
+             Rate    bare   bare2 return2  return
+bare    3188585/s      --     -1%     -5%     -5%
+bare2   3220761/s      1%      --     -4%     -5%
+return2 3339732/s      5%      4%      --     -1%
+return  3372640/s      6%      5%      1%      --
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmoosex-has-sugar-perl.git



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