使用编译代码和PHP加速器之间的差异来提高性能

时间:2022-09-17 21:51:52
  • Recently I read about PhalconPHP. In some rankings of framework phalcon is first, and it's because phalcon is written as a C-extension and it means the code isn’t interpreted because is already compiled.

    最近我读到了PhalconPHP。在框架的一些排名中,phalcon是第一个,这是因为phalcon被编写为C扩展,这意味着代码不会被解释,因为已经编译了。

    so we save one step! It's good!

    所以我们保存一步!很好!

  • On the other hand we do have accelerators in PHP, Most PHP accelerators work by caching the compiled opcode/bytecode of PHP representation of php files to avoid the overhead of parsing and compiling source code on each request.

    另一方面,我们在PHP中有加速器,大多数PHP加速器通过缓存PHP文件的PHP表示的编译操作码/字节码来工作,以避免在每个请求上解析和编译源代码的开销。

    again, we save one step!

    再一次,我们省了一步!

    The questions are:

    问题是:

    1.what's the differences between these two in performance not at architect?

    1.这两者在性能上的区别在于建筑师的差异?

    2.should we choose one of them,is not it something called rework?

    我们应该选择其中之一,是不是称之为返工?

Thank you.

2 个解决方案

#1


0  

Questions about performance without specific use cases are a bit vague for this site, consider adding examples of what you are trying to achieve. Any performance gain from any system will depend heavily on the code, database, schema etc etc.

有关没有特定用例的性能的问题对于此站点来说有点模糊,请考虑添加您尝试实现的示例。任何系统的任何性能提升都将在很大程度上取决于代码,数据库,架构等。

That being said my personal experience with Phalcon is very positive. I rewrote a Zend Framework v1 / Doctrine 2 CMS in phalcon and some page builds up to 10x faster, with up to 70% reduction in reported memory usage. I don't plan on every going back to a pure PHP framework if I can help it.

话虽如此,我对Phalcon的个人经历非常积极。我在phalcon中重写了Zend Framework v1 / Doctrine 2 CMS,并且一些页面构建速度提高了10倍,报告的内存使用率降低了70%。如果我能帮助它,我不会计划每次回到纯PHP框架。

And yes I was using opcode caching for the ZF/D code. In fact I still use it for the phalcon codebase, it is not either/or!

是的,我正在使用操作码缓存ZF / D代码。事实上我仍然将它用于phalcon代码库,它不是/或者!

#2


0  

PHP cached with APC is still iterpreted, for example like Java is, so native code is faster for many common use-cases.

用APC缓存的PHP仍然是假设的,例如像Java一样,因此本机代码对于许多常见用例来说更快。

#1


0  

Questions about performance without specific use cases are a bit vague for this site, consider adding examples of what you are trying to achieve. Any performance gain from any system will depend heavily on the code, database, schema etc etc.

有关没有特定用例的性能的问题对于此站点来说有点模糊,请考虑添加您尝试实现的示例。任何系统的任何性能提升都将在很大程度上取决于代码,数据库,架构等。

That being said my personal experience with Phalcon is very positive. I rewrote a Zend Framework v1 / Doctrine 2 CMS in phalcon and some page builds up to 10x faster, with up to 70% reduction in reported memory usage. I don't plan on every going back to a pure PHP framework if I can help it.

话虽如此,我对Phalcon的个人经历非常积极。我在phalcon中重写了Zend Framework v1 / Doctrine 2 CMS,并且一些页面构建速度提高了10倍,报告的内存使用率降低了70%。如果我能帮助它,我不会计划每次回到纯PHP框架。

And yes I was using opcode caching for the ZF/D code. In fact I still use it for the phalcon codebase, it is not either/or!

是的,我正在使用操作码缓存ZF / D代码。事实上我仍然将它用于phalcon代码库,它不是/或者!

#2


0  

PHP cached with APC is still iterpreted, for example like Java is, so native code is faster for many common use-cases.

用APC缓存的PHP仍然是假设的,例如像Java一样,因此本机代码对于许多常见用例来说更快。