AndrasKovacs / bf

Fast Haskell brainfuck interpreter
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

Sorry, not fast enough #1

Open rdebath opened 8 years ago

rdebath commented 8 years ago

For mandelbrot and turning off the JIT mine runs about double the speed. But you seem to be using llvm which would mean turning off JIT is a bit unfair.

For Urban Muller's 'prime.b' program I seem to be managing about 40 times your speed ... without JIT.

It's taking a while to run all the tests...

AndrasKovacs commented 8 years ago

Fair enough! I just didn't search long enough.

LLVM is just one of standard backends for the interpreter itself, there's no JIT or machine code generation involved anywhere.

rdebath commented 8 years ago

Okay, so it's sort of dependency only not is a Debian packaging problem; okay.

Anyway, I've finally worked out what's wrong with your interpreter and got it to run most of the tests; here's the interpreters I've found that are faster.

I'm not sure how applicable the techniques used will be to Haskel as I usually don't look too closely at it. BTW: You need to fix this line:

      . B.filter (P.inClass "+-<>,.[]")
AndrasKovacs commented 8 years ago

I did test bff.c and bff4.c from http://mazonka.com/brainf/ with mandelbrot.bf and they both were slower than my interpreter (3,5 sec vs. 4,8 sec for bff.c and bff4.c both). Could you maybe tell me your times for these?

I basically only tested with mandelbrot, and omitted some optimizations that made mandelbrot slower but could have potentially benefited other programs.

The line with B.filter is not relevant to interpreter performance, since it's in the parser.

rdebath commented 8 years ago

Sorry, you're quite right, I didn't get the program to sort the table and didn't get it quite right. This looks closer, it's still six of them, but it's a shame you can't see the colours.

<table style="font-family:sans-serif;font-size:10pt;border-collapse:collapse;" bgcolor=white border=1px solid #000 >

InterpreterTotalScore BitwidthEndtestMandelCounterBeerCollatzHanoiGoldenEuler1Prime8LongFactorSelfIntLifeBenchBigTxtLostKngawibZozotezEuler5PrimePIdigitsPIdg-asPIdg-cpPrecalcSkiploopCellCountMoreCells 1081209712411511411411311010710610510495939379613328174468381098012165 Main list bffsree 37.83s 5.568bit0xFF3.13s7.72s0s3.46s0.04s0.03s1.81s0.17s0.15s0.87s4.09s0.02s0s0.05s0s0sSkipSkipSkip200s7.92s8.36s0s0.01s0s0s tritium32_r 131.2s 5.1332bitLeave3.39s6s0.01s3.55s0.06s0.03s0.03s0.13s0.1s0.69s5.37s0.03s0s2.62s0.22s0.11s41.7s49.7s7.8s9.64sSkipSkip0s0s0s0s tritium_r 34.33s 5.128bitLeave3.4s5.99s0.01s3.54s0.06s0.03s1.22s0.12s0.1s0.69s5.4s0.03s0s2.69s0.23s0.11sSkipSkipSkip200s6.18s4.53s0s0s0s0s rdb_bf2run 33.05s 4.838bitLeave3.6s4.2s0.02s2.46s0.05s0.03s1.48s0.23s1.18s0.82s3.81s0.03s0s0.02s0.08s0.19sSkipSkipSkip200s5.81s9.03s0s0.01s0s0s rdb_bf2run32 138.6s 4.8332bitLeave3.6s4.2s0.02s2.46s0.05s0.04s0.02s0.23s1.19s0.82s3.81s0.03sSkip0.02s0.07s0.25s39.9s57.6s14.5s9.76sSkipSkip0s0.01s0s0s rinoldm_sbfi 55.09s 4.388bitLeave3.97s7.84s0s5.47s0.23s0.06s1.35s7.99s5s1.46s4.91s2.35s0.01s0.01s0.07s0.15sSkipSkipSkip200s7s7.19s0s0.01s0s0.02s rinoldm_sbfi32 129.2s 4.3232bitLeave4.03s7.69s0s5.19s0.25s0.06s0.09s8.17s5.08s1.51s4.99s2.32sSkip0.01s200s0.15s57.9s200s80s31.7sSkipSkip0s0.01s0s0.02s deadbeef 60.13s 4.038bitLeave4.32s6.15s0.02s4.12s0.44s0.06s19.8s7.02s2.89s1.65s4.75s1.95s0.01s0.01s0.05s0.33sSkipSkipSkip200s6.55s100s0s0s0.01s9s twal_sbf 58.34s 3.198bitZero5.45s9.52s0s6.82s0.45s0.04s2.34s3.82s2.17s1.24s5.6s0.05s0.02s0.04s0.04s0.08s0.1sSkipSkip200s8.04s12.7s0s0s0s0s AndrasKovacs_fastbf 67.79s 3.058bitAbort5.7s8.51s0.01s4.48s0.38s0.1s16s5.72s2.82s1.63s15.7s1.61s0.01s0.09s0.43s0.13sSkipSkipSkip200s4.55s100s0s0.02s0.02s0.01s
AndrasKovacs commented 8 years ago

Thanks, your table is quite amazing, and it's very helpful to have all test programs and interpreters in one place. Maybe later I'll benchmark more of your test programs and try to do other optimizations as well.