# Why is this assembly so slow? This is a super nieve implementation of brainf*** which gererates QBE's SSA which then generates assembly code. It generates a HUGE number of instructions, but I still don't understand why this is SIGNIFICANTLY slower then a similarly nieve interpreter. my thought was that even with a really silly implementation like this, it should still be "as fast" as the nieve interpreted version. What am I doing wrong? How is it so slow? perf stat ./a.out Performance counter stats for './a.out': 64349.894949 task-clock (msec) # 0.994 CPUs utilized 2954 context-switches # 0.046 K/sec 41 cpu-migrations # 0.001 K/sec 56 page-faults # 0.001 K/sec 165977623096 cycles # 2.579 GHz 84423861810 stalled-cycles-frontend # 50.86% frontend cycles idle 408147701564 instructions # 2.46 insn per cycle # 0.21 stalled cycles per insn 163231360063 branches # 2536.622 M/sec 964017 branch-misses # 0.00% of all branches 64.737943963 seconds time elapsed