网站的解释语言与编译语言(PHP、ASP、Perl、Python 等) [英] Interpreted vs. Compiled Languages for Web Sites (PHP, ASP, Perl, Python, etc.)

查看:39
本文介绍了网站的解释语言与编译语言(PHP、ASP、Perl、Python 等)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我构建了数据库驱动的网站.以前我在 MySQL 中使用过 Perl 或 PHP.

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 the most responsive possible site.

我在这里看到了几个页面,其中关于如何优化 PHP 的问题受到各种版本的批评,不值得花费大量精力来优化 PHP,因为它是一种解释性语言,并且不会产生太大差异".

I have seen several pages here where questions about how to optimize PHP are criticized with various versions of "it's not worth going to great lengths to optimize PHP since it's an interpreted language and it won't make that much difference".

我还听到了各种关于编译语言与解释语言的好处的讨论(特别是在 SO 播客上),似乎使用编译语言来提供网站而不是解释性语言.

I have also heard various discussions (especiallon on the SO podcast) about the benefits of compiled vs. interpreted languages, and it seems as though it would be in my interests to use a compiled language to serve up the site instead of an interpreted language.

这在网络环境中是否可行?如果是这样,合理的语言选择是什么?

Is this even possible in a web context? If so, what would be a reasonable language choice?

除了速度之外,我预见的一个好处是可以在编译时发现错误,而不必调试网站.这是合理的预期吗?

In addition to speed one benefit I forsee is the possiblity of finding bugs at compile time instead of having to debug the web site. Is this reasonable to expect?

推荐答案

您可以做的是多个高流量网站(如 Facebook 或 Twitter)所做的事情,也就是在 C 插件中编写您的CPU 消耗"算法.

What you can do is what multiple heavy-traffic websites do (like Facebook or Twitter), aka write your "CPU consuming" algorythm in a C-plugin.

例如,如果您打算使用 PHP,您可以编写一个 PHP 扩展,或者Ruby 扩展(如果您打算使用 Ruby/Ruby on Rails 等)

For example, you could write a PHP extension if you plan to use PHP, or a Ruby extension if you plan to use Ruby / Ruby on Rails, etc.

这样,您可以保持流线型代码简单且易于维护(处理来自 C 而不是来自 PHP 的请求可能更难),同时拥有强大而坚实的背景核心(因为它已编译,并且编译器告诉你编译时的问题)

That way, you can keep your streamline code simple and easy to maintain (it might be way harder to handle request from C rather than from PHP), while having a strong and solid background core (because it's compiled, and the compiler tells you what the issues are at compile time)

这篇关于网站的解释语言与编译语言(PHP、ASP、Perl、Python 等)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆