Created
December 6, 2016 14:11
-
-
Save foursixnine/80403aa86ae5d77dac0f1b776d476f79 to your computer and use it in GitHub Desktop.
Quick test to see if using unlink is fast enough vs just symlinking directly.
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
use strict; | |
use warnings; | |
use Benchmark::Stopwatch; | |
my $stopwatch = Benchmark::Stopwatch->new->start; | |
my $i = 0; | |
$stopwatch->lap("start"); | |
opendir(my $dh, ".") || die "Can't open dir : $!"; | |
while (readdir $dh) { | |
next if /last|linktest/; | |
$i++; | |
unlink("last.png"); | |
symlink($_, "last.png"); | |
$stopwatch->lap("Link_$_"); | |
} | |
print $stopwatch->summary(); #bogus, this can't handle time in ms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment