3 ms·
I think it depends. Writing a compiler in a low-level language won't necessarily result in better performance. It can, if you put in enough performance work, of
by wtetzner 6y ago
I think it depends. Writing a compiler in a low-level language won't necessarily result in better performance. It can, if you put in enough performance work, of course.
But if you want to keep the code simpler, a higher-level language could potentially give better performance, simply because it's easier to share data structures, avoid copying, etc. Additionally, things like immutable persistent maps are a great fit for environments in a compiler, and they are much easier to implement in a language with garbage collection.
That said, obviously some high-level languages are still going to be too slow without also putting in a lot of work. I think there's a sweet spot with languages that compile to reasonably fast machine code but are also garbage collected. Languages like OCaml, Go, Haskell. Though I personally wouldn't use Go, but that's for reasons other than performance.