JIT (即时编译)编译器

  1. JIT (Just-In-Time)即时编译器是 PHP 8.0 中最重要的新功能之一,可以极大地提高性能。
  2. JIT 编译器将作为扩展集成到 php Opcache 扩展 用于运行时将某些操作码直接转换为从 cpu 指令。 仅在启用 opcache 的情况下,JIT 才有效

1、Opcache 扩展

● OPcache 通过将 PHP 脚本预编译的字节码存储到共享内存中来提升 PHP 的性能, 存储预编译字节码的好处就是:省去了每次加载和解析 PHP 脚本的开销。

2、Opcache 开启

文件位置:softs\php\php-8.0.2-nts\php.ini
zend_extension=opcache

3、Opcache 配置

; Determines if Zend OPCache is enabled
opcache.enable=1

; Determines if Zend OPCache is enabled for the CLI version of PHP
opcache.enable_cli=0

; The OPcache shared memory storage size.
opcache.memory_consumption=128

; The amount of memory for interned strings in Mbytes.
opcache.interned_strings_buffer=8

; The maximum number of keys (scripts) in the OPcache hash table.
; Only numbers between 200 and 1000000 are allowed.
opcache.max_accelerated_files=10000

4、JIT 配置(新增)

opcache.jit=tracing
opcache.jit_buffer_size=100M

5、php 扩展目录

extension_dir = "ext"   //开启