Skip to content

Disappointing performance from rust interpreter. #4

Description

@rdebath

The below BF code is generally pretty optimisable, but the example runs in your interpreter in 12seconds.

Others are: a first attempt interpreter at 20s, simple loop linking at 10s, a more complex no-lookahead interpreter at 5s, a primitive JIT at 2s. The more heavily optimising interpreters (Even without JIT!) are subsecond.

>+>++>+>+<[>[-<+++++>]<<]>[->+>+<<]>[->[->+>+>
+<<<]>>>[-<<<+>>>]<<[->[->+>+>+<<<]>>>[-<<<+>>
>]<<[->[-]<[->+>+<<]>>[-<<+>>]<<]<<]>[-]<<<]>[
-]<++++++++[<++++++++++>-]<-.----.<++++++++++.
$ target/release/rust-bf -oa -c EasyOpt.b
Compressing bf code...
Pre-matching braces...
Running bf code
Output: OK

BF execution done
Time taken: 12.10692s
$ time trixy -microbf EasyOpt.b
OK

real    0m19.639s
user    0m19.632s
sys     0m0.004s
$ time trixy -minibf EasyOpt.b
OK

real    0m9.661s
user    0m9.656s
sys     0m0.000s
$ time deadbeef EasyOpt.b
OK

real    0m5.545s
user    0m5.540s
sys     0m0.000s
$ time gcc-jit EasyOpt.b
OK

real    0m2.128s
user    0m2.124s
sys     0m0.000s
$ time bfi -b128 -r EasyOpt.b
OK

real    0m0.063s
user    0m0.060s
sys     0m0.000s
$ profilebf EasyOpt.b
OK
Program size 184
Final tape contents:
 : 10 75  0  0  0  0  0  0  0
    ^
Tape pointer maximum 8, cell value range 0..161
Skipped loops (zero on '['): 51842
Counts:     +: 1018384868   -: 1018384783   >: 1373269843   <: 1373269843
Counts:     [: 12598258     ]: 1018384781   .: 3            ,: 0
Total:         5814292379   run: 0.453s
$ 

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions