Hacker News new | past | comments | ask | show | jobs | submit login

This is an old famous paper which got a lot of arguments wrong, and a lot right.

The famous result is the old computed goto vs switch argument, which basically comes down to switch adds bounds-checking overhead. He didn't get that. Most commenters neither. He also cemented the poor wording "threaded interpreter" and "indirect branching" for different concepts. It's also a totally unimportant feature of making interpreters fast.

Indirect call overhead is significant and measurable. Jit compilers made that obsolete.

He didn't get the case against perl. perl has a huge op and data overhead, as is way too dynamic. But the dispatch loop is better than the others, as perl always returns the pointer to the next op already. There's no dispatch.

Much better interpreter optimization papers came later with lua, reiterating old lisp results. Note: not luajit. lua already had a perfect interpreter loop. lua uses the lisp architecture of small tagged dynamic data, plus a tiny opset, efficiently stored in a single word, with 2-3 arguments. python with its linearizing cfg optimizer tried to mimic it a bit, but is still too slow. Many one-word primitives allow fast stack allocation and updates, and one-word ops allow fast icache throughput.




> Much better interpreter optimization papers came later with lua, reiterating old lisp results.

Can you point to some of those papers?


Thanks for the overview an perspective. When you say lua' interpreter loop is perfect, are there any better? Is lua state of the art here?


For unjitted interpreters writren in C Lua and few other lisp and Lua derived interpreters are perfect.

With jit added, luajit is perfect. This is a completely different beast. Also the self/strongtalk derived jits of course: hotspot and v8.


I also imagine this is only inside a C interpreter. One made in .NET will require other solution?


With a managed runtime/interpreter most of what makes an interpreter fast or slow is taken away from you.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: