2 ms·
Optimising the program absolutely will win in general, because the optimisations are extremely cheap and very impactful. See https://github.com/john-h-k/rustfuc
by john-h-k 2y ago
Optimising the program absolutely will win in general, because the optimisations are extremely cheap and very impactful. See https://github.com/john-h-k/rustfuck https://github.com/john-h-k/rustfuck for an example of the sort of speedup differences you can get with different optimisation levels
- bob1029 2y agoCould the optimizer still help in the general case if you only ever intend to run each program one time? If so, I probably need to spend a lot more time in this rabbit hole.
- john-h-k 2y agoYes. The biggest win (that you may already do) is recording branch positions, so when you hit a `[` or `]` knowing exactly where to jump through rather than going left/right. My interpreter above isn't the most advanced (it was a few hours while hungover because it seemed fun!), but try throwing it at your thing and I suspect it could help. ``` cargo install --git https://github.com/john-h-k/rustfuck https://github.com/john-h-k/rustfuck rustfuck <source> --lir # or --jit if you are on arm64 and don't need to read from stdin ```