[HN Gopher] Rewriting (and optimizing) a tree-walking interprete...
___________________________________________________________________
Rewriting (and optimizing) a tree-walking interpreter in Rust
Author : dvko
Score : 15 points
Date : 2022-11-22 10:29 UTC (1 days ago)
(HTM) web link (www.dannyvankooten.com)
(TXT) w3m dump (www.dannyvankooten.com)
| dvko wrote:
| Hey everyone.
|
| I wanted to get more experience writing Rust so I decided to
| build an interpreter in Rust and attempt to make it just as fast
| as another one I made in C. In this post I describe my journey to
| make it run fast. Most of it will probably be super obvious if
| you're experienced with Rust, but hopefully some of it is useful
| to more people. For example, I feel it's just too easy to call
| `.clone()` to store an owned value instead of storing a reference
| and introducing the correct lifetime constraints.
|
| Overall it was (is!) a fun project and working in Rust has been a
| very nice experience. Let me know if you have any suggestions
| please.
| FullyFunctional wrote:
| This was great and introduced a few tools I didn't know. I hope
| you will take it as far as you can, but I think you're going to
| need a better benchmark :) It would be nice if there were a way
| to safely JIT from Rust; say a special closure that gets
| recompiled on the fly based on the value of its free variables.
| SevenNation wrote:
| The code makes it clear that the --release flag is being used,
| but not the text. Sometimes optimization posts written by authors
| trying to up their skills end with a "...and then I turned on the
| release flag and tada - 80% improvement." It might be useful to
| point out that release mode is being used to compile.
___________________________________________________________________
(page generated 2022-11-23 23:00 UTC)