4 ms·
> An interpreter is totally in the clear on these subjects and should not have anyone reaching for unsafe. This is true for a toy interpreter. You don’t “need”
by celeritascelery 4y ago
> An interpreter is totally in the clear on these subjects and should not have anyone reaching for unsafe.
This is true for a toy interpreter. You don’t “need” unsafe. But anything other then a toy interpreter has many reasons to reach for unsafe: garbage collection, flexstr, object dispatch, tagged pointers, etc. Not to mention the performance gains from using unchecked functions in hot sections of the interpreter loop.
- speed_spread 4y agoThe arbitrary difference between a "toy" and a "tool" is the completeness of the proposed solution. Correctness, ease of use and documentation concerns could come well before execution speed. I agree that writing an interpreter for an existing language (e.g. Python) one would want to match the performance of existing interpreters and thus would need to use the techniques you mention.