Hmm..

Perl (John Trammell):

#!/bin/sh
# perl1.sh
echo -e '10 1\n10 -1' | \
perl -pe 's/(\d+) (-?\d+)/($2>0)?$1<<$2:$1>>-$2/e'

[mike at 3po][~]$ /usr/bin/time perl1.sh
20
5
0.02user 0.02system 0:00.04elapsed 88%CPU (0avgtext+0avgdata
0maxresident)k
0inputs+0outputs (526major+137minor)pagefaults 0swaps


C (Jason DeStefano):

#!/bin/sh
# c1.sh
cat > bitshift.c <<EOF
#include <stdio.h>
main() {
    int x;
    fscanf(stdin, "%d", &x);
    return (x << 4);
}
EOF
gcc bitshift.c -o bitshift
echo 3 | ./bitshift
echo $?

[mike at 3po][~]$ /usr/bin/time c1.sh
48
0.23user 0.14system 0:00.38elapsed 96%CPU (0avgtext+0avgdata
0maxresident)k
0inputs+0outputs (2122major+1027minor)pagefaults 0swaps

OTOH...

#!/bin/sh
# c1-2.sh
echo 3 | ./bitshift
echo $?

[mike at 3po][~]$ /usr/bin/time c1-2.sh
48
0.00user 0.02system 0:00.04elapsed 50%CPU (0avgtext+0avgdata
0maxresident)k
0inputs+0outputs (329major+117minor)pagefaults 0swaps


C (my example - functionally similar to Perl example):

#!/bin/sh
# c2.sh
cat > bitshift.c <<EOF
#include <stdio.h>
main () {
  int x, y;
  while (scanf ("%d", &x) > 0 && scanf ("%d", &y) > 0) {
    printf ("%d\n", (y >= 0) ? (x << y) : (x >> -y));
  }
  return 0;
}
EOF
gcc bitshift.c -o bitshift
echo -e '10 1\n10 -1' | ./bitshift

[mike at 3po][~]$ /usr/bin/time c2.sh
20
5
0.30user 0.08system 0:00.39elapsed 97%CPU (0avgtext+0avgdata
0maxresident)k
0inputs+0outputs (2147major+1030minor)pagefaults 0swaps

Again, OTOH...

#!/bin/sh
# c2-2.sh
echo -e '10 1\n10 -1' | ./bitshift

[mike at 3po][~]$ /usr/bin/time c2-2.sh
20
5
0.02user 0.01system 0:00.03elapsed 78%CPU (0avgtext+0avgdata
0maxresident)k
0inputs+0outputs (331major+113minor)pagefaults 0swaps


Obviously, it's really hard to get decent timings on such small
programs, but I ran these a couple of times with fairly consistent
results.  The C programs ran a little faster than the Perl code, but
that was after compiling.  In order for the C code to show a definite
advantage, it would probably have to be run many, many times, or on a
large amount of input data.  (Note the latter is the case with regard to
the new 7-line C and Perl CSS descramblers)

-- 
 _  _  _  _ _  ___    _ _  _  ___ _ _  __   Eagles may soar, but 
/ \/ \(_)| ' // ._\  / - \(_)/ ./| ' /(__   weasels don't get sucked  
\_||_/|_||_|_\\___/  \_-_/|_|\__\|_|_\ __)  into jet engines. 
[ Mike Hicks | http://umn.edu/~hick0088/ | mailto:hick0088 at tc.umn.edu ]