Interesting statement. It led me to this paper:
Branch Prediction and the Performance of Interpreters - Don’t Trust Folklore (2015)
https://hal.inria.fr/hal-01100647/document (pdf)
"..Many studies go back to when branch predictors were not very aggressive. Folklore has retained that a highly mispredicted indirect jump is one of the main reasons for the inefficiency of switch-based interpreters."
"The accuracy of branch prediction on interpreters has been dramatically improved over the three last Intel processor generations. This..has reached a level where it cannot be considered as an obstacle for performance anymore."
Personally, I stopped worrying and used the most convenient implementation for my use case (portable interpreter written in C). Your set of primitives and how you code your Forth programs usually have a much larger improvement potential.
Is this statement for indirect threaded Forths only? What about direct threaded, token threaded and sub-routine threaded Forths?
[1] "threaded" has nothing to do with multithreaded: https://en.wikipedia.org/wiki/Threaded_code
https://stackoverflow.com/questions/5127833/meaningful-cost-...
"But in general, on modern processors, there is minimal cost for an unconditional jump. It's basically pretty much free apart from a very small amount of instruction cache overhead. It will probably get executed in parallel with neighbouring instructions so might not even cost you a clock cycle. "
I recently tried porting Jonesforth to UEFI[2], so I could run it directly on my hardware without needing an operating system. I was actually surprised by how easy it turned out to be.
Okay, admittedly I ended up rushing a bit towards the end, and the final result is very bare-bones - it can do "Hello, World!", Fibonacci numbers, and then that's pretty much it. Still, it was a lot of fun, and I would totally recommend a project like this, especially if you don't usually work with "low-level" development.
I also ended up writing a blog post[3] to help people get started writing assembly for UEFI. The best resource is probably the OS Dev wiki, though. It has a ton of great resources.
[1]: https://github.com/nornagon/jonesforth
[2]: https://github.com/c2d7fa/jonasforth
[3]: https://johv.dk/blog/bare-metal-assembly-tutorial.html
[4]: https://wiki.osdev.org/Expanded_Main_Page