Skip to content

Instantly share code, notes, and snippets.

@agausmann
Last active May 26, 2017 19:32
Show Gist options
  • Save agausmann/daeb55899fbe3ca1da49a4a8caff9915 to your computer and use it in GitHub Desktop.
Save agausmann/daeb55899fbe3ca1da49a4a8caff9915 to your computer and use it in GitHub Desktop.
StackJam benchmark programs
top:
000000 1000 # push 0
000001 1100 0101 # pop $4
000011 1001 # push 1
loop:
000100 1100 0100 # push $4
000110 0000 # add
000111 1100 0101 1100 0100 # sav $4
001011 1001 0100 1101 0010 1000 1000 0111 # jo top
010010 1101 0100 # push $5
010100 0000 # add
010101 1101 0101 1101 0100 # sav $5
011001 1000 1000 1100 0111 # jmp loop
# Init: 48 ticks
# Loop: 96 ticks * 4 iterations + 72 ticks * 3 iterations
# Avg: 93 ticks / iteration
000000 1000 # push 0
000001 1000 # push 0
000010 1100 0101 # pop $4
loop:
000100 1100 0100 # push $4
000110 1100 0100 # push $4
001000 1001 # push 1
001001 0000 # add
001010 1100 0101 1100 0100 # sav $4
001110 0000 # add
001111 0000 # add
010000 1000 1000 1100 # jmp loop
# Init: 24 ticks
# Loop: 108 ticks * 4 iterations
# Avg: 114 ticks / iteration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment