Why are Interpreted Languages Slow?

前端 未结 15 1506
南旧
南旧 2020-12-24 11:05

I was reading about the pros and cons of interpreted languages, and one of the most common cons is the slowness, but why are programs in interpreted languages slow?

15条回答
  •  执念已碎
    2020-12-24 11:36

    There is no such thing as an interpreted language. Any language can be implemented by an interpreter or a compiler. These days most languages have implementations using a compiler.

    That said, interpreters are usually slower, because they need process the language or something rather close to it at runtime and translate it to machine instructions. A compiler does this translation to machine instructions only once, after that they are executed directly.

提交回复
热议问题