Home

Awesome

Whitespace JIT

A Whitespace compiler/interpreter written in C++. The JIT compiler supports x86_64 machines with System V AMD64 ABI calling conventions. The interpreter should be more universally usable. For some sample Whitespace programs, see the Esolangs page or my Whitespace programs repository.

Usage

Dependencies

Compiling

To compile, just run make.

Running

The default make rule will compile the compile executable. The compile executable's first argument is t (to use the JIT compiler) or f (to use the interpreter); the second argument is the filename.

Usage: ./compile <use_jit:t|f> <filename>

Speed Comparison

Below are the comparison runs for 1. the original whitespace interpreter (version 0.3), 2. this repository's interpreter, 3. this repository's JIT compiler. The timing was done using bash's builtin time for running the three programs with stdout redirected to /dev/null on is_prime.ws, a simple whitespace program that calculates the primes up to 20,000 using the naive O(n^2) algorithm. This program requires the execution of 234,248,149 instructions.

Commandrealusersys
time ./wspace programs/is_prime.ws >/dev/null 27.594s27.345s0.213s
time ./compile f programs/is_prime.ws >/dev/null0.954s0.942s0.007s
time ./compile t programs/is_prime.ws >/dev/null0.248s0.244s0.002s

Speed-up relative to original interpreter

Commandrealusersys
time ./wspace programs/is_prime.ws >/dev/null 1x1x1x
time ./compile f programs/is_prime.ws >/dev/null28.925x29.029x30.429x
time ./compile t programs/is_prime.ws >/dev/null111.266x112.070x106.5x

Instructions per second (234248149 / real time)

NameInstructions per second
Original interpreter8,489,097
This repository's interpreter394,357,153
JIT compiler944,548,987

Acknowledgments

Inspired by whitespace-rs