SWIG generates perl, python, ruby, ocaml, java, etc. modules from your C(++) code. If you have something that would be much faster in
C(++) and it's currently bogging your perl down, take a look at SWIG.
SWIG is mind-numbingly easy to use:
- e-slow.pl using straight perl to expand e to 2000 digits (~13.22s to run)
- e.c char *e(int k)
- same algorithm, but in c
- e.i the swig definition file to create the perl module (yes, that's it!)
- Makefile commands to make the perl module (change the perl include to fit your box)
- e-fast.pl using the new e module (~0.54s to run)