Interpreted vs. Compiled Languages for Web Sites (PHP, ASP, Perl, Python, etc.)

前端 未结 7 809
名媛妹妹
名媛妹妹 2021-02-09 10:04

I build database-driven web sites. Previously I have used Perl or PHP with MySQL.

Now I am starting a big new project, and I want to do it in the way that will result in

7条回答
  •  不思量自难忘°
    2021-02-09 10:24

    If you were going to build a new language... and you came up with all the semantics and it was complete, and you had some magic box that had a switch between making the language compiled vs. interpreted, the compiled version would be faster than the interpreted version.

    Why? Because compiling brings your semantics down to a lower level on the machine which means it can executed much faster, whereas interpreting means the semantics of your language will translated by some thing (i.e. the interpreter) when the user actually uses your site.

    Having said that... that doesn't necessarily mean that your site is going to 100% run faster on a compiled language vs an interpreted language. There are interpreters out there that are very fast nowadays for various languages (i.e. PHP), and there are even optimizers for interpreted languages that make them faster even still.

    There are many other things that go into the performance of your site that are agnostic of the language you choose. Hardware setup, Database setup, Network topology, etc. These things can have a bigger impact on you. I would suggest measuring to be sure.

    For me, finding bugs at compile time is a huge time saver, so I tend to prefer compiled languages which are strongly typed. It lets me get my work done faster, but that doesn't make it objectively the best option. Some people have no issue writing weakly typed code, and running test suites on them to verify their functionality, which I would think would work just as well.

提交回复
热议问题