Skip to content

Instantly share code, notes, and snippets.

@Tekki
Created November 18, 2018 10:40
Show Gist options
  • Save Tekki/00e550018936436d2443dc529ab25543 to your computer and use it in GitHub Desktop.
Save Tekki/00e550018936436d2443dc529ab25543 to your computer and use it in GitHub Desktop.
Perl 5 Speedtest
#!/usr/bin/env perl
use v5.10;
package Point;
sub new {
my ($class, %args) = @_;
bless \%args, $class;
}
sub x {
my $self = shift;
$self->{x}
}
sub y {
my $self = shift;
$self->{y}
}
package main;
my $total = 0;
for (1..100_000_000) {
my $p = Point->new(x => 2, y => 3);
$total = $total + $p->x + $p->y;
}
say $total;
@Tekki
Copy link
Author

Tekki commented Nov 18, 2018

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