Skip to content

Releases: shadowofneptune/threaded-code-benchmark

Threaded Code Benchmark

15 Jan 15:45
b19f8fb

Choose a tag to compare

Threaded code is a technique used in the implementation of virtual machines
(VMs). It avoids the overhead of calling subroutines repeatedly by 'threading'
them together with jumps. This was originally done in assembly, where it is the
most straightforward to implement. In C, it is harder to implement
threaded code that is also performant.

These files are a test of three different techniques for produced fast threaded
code. Each .c file implements a simple VM that counts to 2 billion, printing
a star whenever the loop counter is evenly divisible by 200 million. The
test settings can be changed in threaded_code.h. They all can be compiled and
run with 'make benchmark'.