- or download this
#!/usr/bin/env perl
use warnings;
...
$sub{$name} = $code;
}
- or download this
# The original subroutine
...
join '', @rotd{split('',shift)};
};
- or download this
# Two variants instead of the split
...
join '', @rotd{unpack "(a)*", $x};
};
- or download this
# Now let's use an array slice instead of a hash
...
$s;
};
- or download this
# First, check correctness. This is important.
...
in, dictum in, blandit eu, sapien. Morbi vestibulum, metus eu auctor v
+ulputate,
nulla lectus condimentum nisi, ac pulvinar ligula nunc in felis. Curab
+itur id
orci ac est luctus molestie.
- or download this
Rate orig hashslice-m gsub-dot hashslice-s gsub-clas
+s hashslice-u arrayslice tr
orig 962/s -- -20% -30% -40% -43
+% -58% -82% -99%
...
hashslice-u 2278/s 137% 89% 66% 42% 35
+% -- -58% -98%
arrayslice 5414/s 463% 349% 295% 237% 221
+% 138% -- -96%
tr 148174/s 15308% 12184% 10701% 9135% 8681
+% 6403% 2637% --