From 01883b475e8f64f10f61c44e56675fafdfef8db1 Mon Sep 17 00:00:00 2001 From: Timofey Potapov Date: Mon, 2 Sep 2024 08:52:30 +0200 Subject: [PATCH] Updated pod for n with an example. --- README.md | 7 +++++++ lib/e.pm | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/README.md b/README.md index a63ce3c..5f9033e 100644 --- a/README.md +++ b/README.md @@ -214,6 +214,13 @@ Benchmark and compare different pieces of code. fast => sub{ ... }, }, 10000; + $ perl -Me -e '$v = 333; n { concat => sub { 111 . $v }, interp => sub { "111$v" }, list => sub { 111,$v } }, 100000000' + + Rate interp concat list + interp 55248619/s -- -6% -62% + concat 58479532/s 6% -- -60% + list 144927536/s 162% 148% -- + ## Format Conversions ### j diff --git a/lib/e.pm b/lib/e.pm index 7b171d0..a70ae6d 100644 --- a/lib/e.pm +++ b/lib/e.pm @@ -232,6 +232,13 @@ Benchmark and compare different pieces of code. fast => sub{ ... }, }, 10000; + $ perl -Me -e '$v = 333; n { concat => sub { 111 . $v }, interp => sub { "111$v" }, list => sub { 111,$v } }, 100000000' + + Rate interp concat list + interp 55248619/s -- -6% -62% + concat 58479532/s 6% -- -60% + list 144927536/s 162% 148% -- + =cut =head2 Format Conversions