Skip to content

Instantly share code, notes, and snippets.

View Reconcyl's full-sized avatar

Reconcyl Reconcyl

View GitHub Profile
@Reconcyl
Reconcyl / CompileSpeed.md
Last active January 7, 2021 20:06
Test compiler speeds!

This script generates long repetitive programs in various languages (statically typed ones that target native code) and measures the time taken to compile them.

Every program is roughly of the form:

main() {
    var x = 0
    {% n*2 times: %}
    x = 2
    print(i)

x = 3

import Data.List (foldl')
update :: (Int, [Int]) -> (Int, [Int])
update (n, []) = (n, [])
update (n, 0:ms) = (n+1, ms)
-- optimization: ack(1, n) = n + 2
update (n, 1:ms) = (n+2, ms)
update (0, m:ms) = (1, (m-1):ms)
update (n, m:ms) = (n-1, m:(m-1):ms)