期待已久的 PHP 的 JIT 终于要来了

https://wiki.php.net/rfc/jit

Dmitry 提交了一个关于将 jit 加入 PHP 的 rfc,看起来已经开发地差不多了(感谢 Dmitry 和鸟哥~)。

下面是 RFC 的大致内容(与原文不完全一致,加入了自己的一些理解)

JIT 的好处

主要是 JIT 带来的性能提升,以及性能提升对整个语言使用场景的扩展及语言生态发展的支持。

  1. 目前已经很难通过常规手段提升 PHP 的性能,JIT 基本上是目前性能提升的唯一手段;
  2. JIT 带来的性能提升可以让 PHP 在更多使用场景( CPU 密集)中发挥作用;
  3. 可以使用 PHP 来开发内置函数,而不用担心性能方面的问题。这一方面可以加速语言的发展(更多人可以参与进来),同时也可以减少目前使用 C 开发容易出现的内存管理、溢出等问题

实现细节

  • 作为 OPcache 一个独立组件开发,可以在 PHP 内核编译时或运行时启用,生成的 native 代码保存在 OPcache 共享内存一个额外区域;
  • 使用 LuaJIT 的 DynAsm 库实现 native 代码生成,不使用 LLVM 是因为它生成代码的速度太慢了;
  • 目前只支持 x86、x86_64 POSIX 平台,未来会提供更多平台的支持;
  • 使用 PHP 7.4 跑分,开启 JIT 与不开启,性能大致提升 4 倍 (0.011 sec vs 0.046 sec).

预计的发布节点

  • 在 PHP 7.4 中,作为试验特性加入,默认不开启;
  • 在 PHP 8 正式发布

 

官网

PHP.Barcelona 2019

What an incredible 2018 and 2019 for the PHP community! Part of the PHP Core Team that was working for Zend left. Some found excellent companies and they are rocking most than ever, like Nikita at JetBrains. PHP 7.4 is about to be released, and PHP 8 has been branched. Lavarel and Symfony have healthy growth. JIT is part of the imminent future, and I/O non-blocking frameworks are getting more often adopted in production.

We've crafted the best PHP conference possible just for you. To allow you to see the future and get ready before nobody else. You'll gather top-notch speakers and an awesome community eager to share a lot of knowledge. All of this will take place in the very center of the gorgeous city of Barcelona in an excellent venue. What are you waiting for? Go get your tickets here!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值