Skip to content

Instantly share code, notes, and snippets.

@mjsr
Created June 20, 2014 09:33
Show Gist options
  • Save mjsr/c93f4f7f34ebf7bcfd3d to your computer and use it in GitHub Desktop.
Save mjsr/c93f4f7f34ebf7bcfd3d to your computer and use it in GitHub Desktop.
Benchmark unary increments
#!perl
use warnings;
use strict;
use Benchmark qw( timethese );
my ( $preinc, $postinc ) = ( 0, 0 );
timethese(100_000_000, {
'use_preinc' => sub { ++$preinc; },
'use_postinc' => sub { $postinc++; },
});
@mjsr
Copy link
Author

mjsr commented Jun 20, 2014

Thanks guys :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment