Skip to content

Instantly share code, notes, and snippets.

@arnaud-lb
Last active July 2, 2022 00:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arnaud-lb/d9adfbf786ce9e37c7157b0f9c8d8e13 to your computer and use it in GitHub Desktop.
Save arnaud-lb/d9adfbf786ce9e37c7157b0f9c8d8e13 to your computer and use it in GitHub Desktop.

local

Attribute Value
Environment local
Runner docker
Architecture x86_64
CPU 16 cores
RAM 30 GB
Kernel 5.11.0-1022-aws
OS Ubuntu 20.04.3 LTS
Time 2022-05-13 16:02:00

Micro 1 - 15 consecutive runs, 20 requests (sec)

PHP Min Max Std dev Average Average diff % Median Median diff % Memory
PHP 8.x long-closure.php 0.35877 0.36328 0.00114 0.36028 0.00% 0.36005 0.00% 24.22 MB
PHP 8.x-patch1 short-closure.php 0.41705 0.42313 0.00132 0.41881 16.25% 0.41879 16.31% 24.55 MB
PHP 8.x-patch1 long-closure.php 0.37323 0.37655 0.00077 0.37417 3.86% [0] 0.37416 3.92% 24.52 MB
PHP 8.x-patch2 short-closure.php 0.36084 0.36513 0.00111 0.36236 0.58% 0.36199 0.54% 24.37 MB
PHP 8.x-patch2 long-closure.php 0.36080 0.36333 0.00084 0.36199 0.47% 0.36229 0.62% 24.29 MB

Micro 2 - 1 consecutive runs, 1 requests (sec)

PHP Min Max Std dev Average Average diff % Median Median diff % Memory
PHP 8.x long-closure.php 0.02384 0.02384 0.00000 0.02384 0.00% 0.02384 0.00% 32.27 MB
PHP 8.x-patch1 short-closure.php 0.08186 0.08186 0.00000 0.08186 243.37% 0.08186 243.37% 420.01 MB
PHP 8.x-patch1 long-closure.php 0.02699 0.02699 0.00000 0.02699 13.22% [0] 0.02699 13.22% 32.07 MB
PHP 8.x-patch2 short-closure.php 0.02345 0.02345 0.00000 0.02345 -1.65% [0] 0.02345 -1.65% 32.16 MB
PHP 8.x-patch2 long-closure.php 0.02335 0.02335 0.00000 0.02335 -2.06% [0] 0.02335 -2.06% 32.18 MB

PHP versions compared here:

  • PHP 8.x is php-src master at commit 90a845c13f88072af3cc048731936e4a61b3ec3a
  • PHP 8.x-patch1 is the original PR rebased on master: php/php-src#6246
  • PHP 8.x-patch2 is the current PR: php/php-src#8330

The benchmarks:

  • The micro 1 benchmark shows that extra captures increase ref counts, which can causes separations, and lead to extra CPU usage.
  • The micro 2 benchmark shows that extra captures can cause extra memory usage.

Notes:

[0]: This difference is probably only due to variations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment