Perl bindings for the Tiny C Compiler
Perl Other XS
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



C::TinyCompiler - Full C JIT compiling using the Tiny C Compiler

These are Perl bindings to the Tiny C Compiler (TCC). TCC is a very fast, very small, and nearly compliant C-99 compiler. Some benchmarks claim that TCC compiles 7x faster than GCC. TCC does not apply the same sorts of optimizations as GCC, mind you, but it still compiles to machine code. Another important feature of TCC is that it can compile a string of C code to machine code without writing to file. In other words, it can be used as a Just In Time C compiler!

If you do not yet see my point, then consider this: Perl has excellent string manipulation facilities. By combining Perl's ability to manipulate strings and TCC's ability to quickly compile C code, we have an easy, fast way to dynamically generate machine code. Perl's bytecode is fast, of course, but for certain numerical work, this can lead to operations that are orders of magnitude faster.

(Though, admittedly, I don't yet have the benchmarks to prove my point.)


This module depends on Alien::TinyCC, so you must install that first with something like:

cpan Alien::TinyCC
cpanm Alien::TinyCC

Once you have those installed, simply download the contents of this distribution from the Github repo ( or download and unpack the latest tarball from the Download link on the left of the distributions page at http:// Once you have the code, run:

perl Build.PL
./Build test
./Build install


Current development for C::TinyCompiler is hosted on github. To get the latest work, just clone the repo:

git clone

Since I have a hard time keeping the Changes file up-to-date, I wrote a git pre-commit hook that checks that I updated the Changes file and double-checks with me in case I did not. This hook is included in the repo. To enable it in your clone, just copy the hook to your .git/hooks/ directory like so:

# Optional; helps keep the Changes file up-to-date
cp .git/hooks/pre-commit    # Unixen
copy .git/hooks/pre-commit  # Windows


After installing, you can find documentation for this module with the perldoc command.

perldoc C::TinyCompiler

You can also look for information at:


Written by David Mertens, <dcmertens.perl at>


Portions of this code are copyright 2011-2013 Northwestern University. Portions of this code are copyright 2013 Dickinson College. Documentation copyright 2011-2013 David Mertens.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See for more information.