#!/usr/bin/perl

my $N = 100000;
my $S = "I like pie   pie     pie      pie";

my ($su, $ss) = times;
for (1..$N) {
  my $s = $S;
}
my ($eu, $es) = times;
my ($tu, $ts) = ($eu-$su, $es-$ss);
printf "%12s: %6.2f u %6.2f s %6.2f\n", "STUB", $tu, $ts, $tu+$ts;

my ($su, $ss) = times;
for (1..$N) {
  my $s = $S;
  $s =~ s/ +/ /g;
}
my ($eu, $es) = times;
my ($tu, $ts) = ($eu-$su, $es-$ss);
printf "%12s: %6.2f u %6.2f s %6.2f\n", "S", $tu, $ts, $tu+$ts;

my ($su, $ss) = times;
for (1..$N) {
  my $s = $S;
  $s =~ tr/ //s;
}
my ($eu, $es) = times;
my ($tu, $ts) = ($eu-$su, $es-$ss);
printf "%12s: %6.2f u %6.2f s %6.2f\n", "TR", $tu, $ts, $tu+$ts;

