I previously came out with a version that converts a BF program directly
into a module, which has received some optimization contributions from
Matthew Flatt.
Got some pretty good results.

Execute bench.b in cpu time: 1542 ms, (2.2s include compile time).

And mandel.b in cpu time: 3851 ms, (7s include compile time). But you have
to manually "export PLT_CS_COMPILE_LIMIT=100000" environment variable in
order to get compiled and executed properly.

https://gist.github.com/sleepnova/92d7b2a7f077e7de76da4ce31f60335e

[email protected] <[email protected]> 於 2021年3月1日 週一 下午3:39寫道:

> There’s this benchmark on BF interpreter where the Racket
> <https://github.com/kostya/benchmarks/blob/master/brainfuck/bf.rkt> and Chez
> Scheme <https://github.com/kostya/benchmarks/blob/master/brainfuck/bf.ss>
> implementations are very similar, but Chez Scheme is much faster than
> Racket 8.0 at interpreting bench.b
> <https://github.com/kostya/benchmarks#benchb> (3s vs 8s) and mandel.b
> <https://github.com/kostya/benchmarks#mandelb> (40s vs 136s).
>
> There’s the “Racket (Syntax Object)
> <https://github.com/kostya/benchmarks/blob/master/brainfuck/bf-syntax.rkt#L75>”
> variant that directly parses BF’s syntax into Racket syntax object, which
> is faster (3.7s for bench, 82s for mandel), but still significantly behind
> Chez Scheme’s naive interpreter.
>
> Profiling doesn’t give very illuminating results, saying most of the cost
> is from interpreting BF’s loop instruction.
>
> Given that Racket is on Chez, could this benchmark reveal some low hanging
> fruit for improving Racket’s performance?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/83b2819d-8295-4769-944d-fa0c155976dan%40googlegroups.com
> <https://groups.google.com/d/msgid/racket-users/83b2819d-8295-4769-944d-fa0c155976dan%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
- sleepnova
呼叫小黃創辦人 & CEO

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CABa2-7PQp4OnagRZk9QtNtLx67mX0huL3f%3DM71XB_ggxRX-U3w%40mail.gmail.com.

Reply via email to