{"id":312,"date":"2022-07-04T22:30:28","date_gmt":"2022-07-04T13:30:28","guid":{"rendered":"https:\/\/www.b64.pw\/blog\/?p=312"},"modified":"2022-07-04T22:30:29","modified_gmt":"2022-07-04T13:30:29","slug":"php%e3%81%ae%e3%83%90%e3%83%bc%e3%82%b8%e3%83%a7%e3%83%b3%e3%81%94%e3%81%a8%e3%81%aejit%e3%81%ae%e3%83%91%e3%83%95%e3%82%a9%e3%83%bc%e3%83%9e%e3%83%b3%e3%82%b9%e6%af%94%e8%bc%83","status":"publish","type":"post","link":"https:\/\/www.b64.pw\/blog\/?p=312","title":{"rendered":"PHP\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3054\u3068\u306eJIT\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6bd4\u8f03"},"content":{"rendered":"\n<p>docker\u3067\u5404\u30d0\u30fc\u30b8\u30e7\u30f3\u306ePHP\u306ejit\u3092\u52d5\u304b\u3057\u3066\u6bd4\u8f03\u3057\u3066\u307f\u305f\u3002<br>\u7d50\u8ad6\u304b\u3089\u8a00\u3046\u3068\u3042\u307e\u308a\u5dee\u304c\u306a\u3044\u3088\u3046\u306b\u898b\u3048\u308b\u3002\u4f55\u304b\u898b\u843d\u3068\u3057\u304c\u3042\u308b\u306e\u304b\u3082\u3057\u308c\u306a\u3044\u304c\u3001\u3044\u3063\u305f\u3093\u30ed\u30b0\u3068\u3057\u3066\u6b8b\u3057\u3066\u304a\u304f\u3002<\/p>\n\n\n\n<p>\u306a\u304a\u901f\u5ea6\u7684\u306b\u306fPHP7.4\u304c\u4e00\u756a\u901f\u3044\u3002Opcache\u3092off\u306b\u3059\u308b\u3068\u660e\u3089\u304b\u306b\u9045\u3044\u3002<\/p>\n\n\n\n<p>\u691c\u8a3c\u306b\u4f7f\u3063\u305f\u30b3\u30fc\u30c9\u306ffibonacci\u6570\u3092\u6c42\u3081\u308b\u6b21\u306e\u30b3\u30fc\u30c9<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-php\" data-file=\"fibonacci_cli.php\" data-lang=\"PHP\"><code>&lt;?php\n\nfunction fibo_php($i){\n\tif($i&lt;0){\n\t\treturn 0;\n\t}\n\tif($i==0 || $i==1){\n\t\treturn $i;\n\t}\n\treturn fibo_php($i-2) + fibo_php($i-1);\n}\n$n = $argv[1]?? 10;\n\n$start_time = hrtime(true);\n$res = fibo_php($n);\n$elapsed_nano = hrtime(true) - $start_time;\n$elapsed_sec = $elapsed_nano \/ 1000 \/ 1000 \/ 1000;\necho &quot;n={$n}, fibonacci({$n})={$res}&quot;.PHP_EOL;\necho &quot;elapsed time {$elapsed_sec} [sec.]&quot;.PHP_EOL;\n<\/code><\/pre><\/div>\n\n\n\n<p>PHP7.4<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>docker run --rm -it  -v \/path\/to\/source:\/mysource  php:7.4.30-cli bash -cx &quot;docker-php-ext-install opcache &gt;\/dev\/null && php -d opcache.enable_cli=on -d opcache.jit=off \/mysource\/fibonacci_cli.php 40&quot;\n+ docker-php-ext-install opcache\n+ strip --strip-all modules\/opcache.so\n+ php -d opcache.enable_cli=on -d opcache.jit=off \/mysource\/fibonacci_cli.php 40\nn=40, fibonacci(40)=102334155\nelapsed time 7.2267407 [sec.]\ndocker run --rm -it  -v \/path\/to\/source:\/mysource  php:7.4.30-cli bash -cx &quot;docker-php-ext-install opcache &gt;\/dev\/null && php -d opcache.enable_cli=on -d opcache.jit=on \/mysource\/fibonacci_cli.php 40&quot;\n+ docker-php-ext-install opcache\n+ strip --strip-all modules\/opcache.so\n+ php -d opcache.enable_cli=on -d opcache.jit=on \/mysource\/fibonacci_cli.php 40\nn=40, fibonacci(40)=102334155\nelapsed time 7.3659223 [sec.]<\/code><\/pre><\/div>\n\n\n\n<p>PHP8.0.20<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>docker run --rm -it  -v \/path\/to\/source:\/mysource  php:8.0.20-cli bash -cx &quot;docker-php-ext-install opcache &gt;\/dev\/null && php -d opcache.enable_cli=on -d opcache.jit=off \/mysource\/fibonacci_cli.php 40&quot;\n+ docker-php-ext-install opcache\nmake: Circular jit\/zend_jit.lo &lt;- jit\/zend_jit.lo dependency dropped.\n+ strip --strip-all modules\/opcache.so\nmake: Circular jit\/zend_jit.lo &lt;- jit\/zend_jit.lo dependency dropped.\n+ php -d opcache.enable_cli=on -d opcache.jit=off \/mysource\/fibonacci_cli.php 40\nn=40, fibonacci(40)=102334155\nelapsed time 7.4793895 [sec.]\ndocker run --rm -it  -v \/path\/to\/source:\/mysource  php:8.0.20-cli bash -cx &quot;docker-php-ext-install opcache &gt;\/dev\/null && php -d opcache.enable_cli=on -d opcache.jit=on \/mysource\/fibonacci_cli.php 40&quot;\n+ docker-php-ext-install opcache\nmake: Circular jit\/zend_jit.lo &lt;- jit\/zend_jit.lo dependency dropped.\n+ strip --strip-all modules\/opcache.so\nmake: Circular jit\/zend_jit.lo &lt;- jit\/zend_jit.lo dependency dropped.\n+ php -d opcache.enable_cli=on -d opcache.jit=on \/mysource\/fibonacci_cli.php 40\nn=40, fibonacci(40)=102334155\nelapsed time 7.4331118 [sec.]<\/code><\/pre><\/div>\n\n\n\n<p>PHP8.1.17<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>docker run --rm -it  -v \/path\/to\/source:\/mysource  php:8.1.7-cli bash -cx &quot;docker-php-ext-install opcache &gt;\/dev\/null && php -d opcache.enable_cli=on -d opcache.jit=off \/mysource\/fibonacci_cli.php 40&quot;\n+ docker-php-ext-install opcache\nmake: Circular jit\/zend_jit.lo &lt;- jit\/zend_jit.lo dependency dropped.\n+ strip --strip-all modules\/opcache.so\nmake: Circular jit\/zend_jit.lo &lt;- jit\/zend_jit.lo dependency dropped.\n+ php -d opcache.enable_cli=on -d opcache.jit=off \/mysource\/fibonacci_cli.php 40\nn=40, fibonacci(40)=102334155\nelapsed time 7.4398298 [sec.]\nPS D:\\proj\\php\\jit&gt; docker run --rm -it  -v \/path\/to\/source:\/mysource  php:8.1.7-cli bash -cx &quot;docker-php-ext-install opcache &gt;\/dev\/null && php -d opcache.enable_cli=on -d opcache.jit=on \/mysource\/fibonacci_cli.php 40&quot;\n+ docker-php-ext-install opcache\nmake: Circular jit\/zend_jit.lo &lt;- jit\/zend_jit.lo dependency dropped.\n+ strip --strip-all modules\/opcache.so\nmake: Circular jit\/zend_jit.lo &lt;- jit\/zend_jit.lo dependency dropped.\n+ php -d opcache.enable_cli=on -d opcache.jit=on \/mysource\/fibonacci_cli.php 40\nn=40, fibonacci(40)=102334155\nelapsed time 7.4708192 [sec.]<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>docker\u3067\u5404\u30d0\u30fc\u30b8\u30e7\u30f3\u306ePHP\u306ejit\u3092\u52d5\u304b\u3057\u3066\u6bd4\u8f03\u3057\u3066 &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/www.b64.pw\/blog\/index.php?rest_route=\/wp\/v2\/posts\/312"}],"collection":[{"href":"https:\/\/www.b64.pw\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.b64.pw\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.b64.pw\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.b64.pw\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=312"}],"version-history":[{"count":1,"href":"https:\/\/www.b64.pw\/blog\/index.php?rest_route=\/wp\/v2\/posts\/312\/revisions"}],"predecessor-version":[{"id":313,"href":"https:\/\/www.b64.pw\/blog\/index.php?rest_route=\/wp\/v2\/posts\/312\/revisions\/313"}],"wp:attachment":[{"href":"https:\/\/www.b64.pw\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=312"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.b64.pw\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=312"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.b64.pw\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=312"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}