-
-
Save AlexDaniel/cbac99a8c725857d6c3877c35436528f to your computer and use it in GitHub Desktop.
Very basic benchmark provided by jdv79
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 julia | |
pat = r"^ | |
(?<date> \S+ ) \s+ | |
(?<time> \S+ ) \s+ | |
(?<size> \S+ ) \s+ | |
(?<path> \S+ ) | |
$"x | |
for line ∈ readlines() | |
m = match(pat, line) | |
m === nothing && throw("invalid line") | |
(date, time, size, path) = (m[:date], m[:time], m[:size], m[:path]) | |
end |
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 raku | |
my $pat = rx/^ | |
$<date>=[\S+]\s+ | |
$<time>=[\S+]\s+ | |
$<size>=[\S+]\s+ | |
$<path>=[\S+] | |
$/; | |
lines().map: { | |
die "invalid line" unless $_ ~~ $pat; | |
my %parts = $/; | |
} |
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 strict; | |
use warnings; | |
while (<>) { | |
my ($date, $time, $size, $path) = my @parts | |
= $_ =~ /^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)$/; | |
die "invalid line" unless @parts == 4; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment