Created
November 18, 2018 10:40
-
-
Save Tekki/00e550018936436d2443dc529ab25543 to your computer and use it in GitHub Desktop.
Perl 5 Speedtest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compare with Perl 6: https://gist.github.com/Tekki/4d8914d69e673bce82b8e8d435323897