3v4l.org

run code in 300+ PHP versions simultaneously
<?php function hinted(array $a, StdClass $b): int { return count($a); } function unhinted($a, $b) { return count($a); } $max = 10000000; $a = array(1,2,3,4); $b = new StdClass(); $b->foo = "bar"; // run unhinted test first to cause any possible cold startup effects to hit it more to make this as fair as possible for hinted code $start = microtime(true); for ($i=0; $i<$max; $i++) $rv = unhinted($a, $b); $elapsed_unhinted = microtime(true) - $start; printf("unhinted: Elapsed %.2f seconds\n", $elapsed_unhinted); $start = microtime(true); for ($i=0; $i<$max; $i++) $rv = hinted($a, $b); $elapsed_hinted = microtime(true) - $start; printf("hinted: Elapsed %.2f seconds\n", $elapsed_hinted); if ($elapsed_unhinted > 0) { $overhead = $elapsed_hinted / $elapsed_unhinted; if ($overhead <= 1.0) printf("No overhead for hinted signature, factor=%.2\n", $overhead); else printf("Type hinting causes %d %% overhead for small functions.\n", round(100*($overhead - 1.0))); }
Output for 8.4.12
unhinted: Elapsed 0.13 seconds hinted: Elapsed 0.18 seconds Type hinting causes 32 % overhead for small functions.
Output for 8.3.19, 8.4.11
unhinted: Elapsed 0.14 seconds hinted: Elapsed 0.18 seconds Type hinting causes 29 % overhead for small functions.
Output for 8.1.15, 8.3.5, 8.3.8, 8.4.10
unhinted: Elapsed 0.14 seconds hinted: Elapsed 0.18 seconds Type hinting causes 28 % overhead for small functions.
Output for 8.4.9
unhinted: Elapsed 0.14 seconds hinted: Elapsed 0.18 seconds Type hinting causes 35 % overhead for small functions.
Output for 8.3.6, 8.4.8
unhinted: Elapsed 0.14 seconds hinted: Elapsed 0.17 seconds Type hinting causes 22 % overhead for small functions.
Output for 8.1.30, 8.2.13, 8.2.23, 8.3.10, 8.3.13, 8.4.7
unhinted: Elapsed 0.14 seconds hinted: Elapsed 0.18 seconds Type hinting causes 27 % overhead for small functions.
Output for 8.2.8, 8.4.6
unhinted: Elapsed 0.14 seconds hinted: Elapsed 0.17 seconds Type hinting causes 25 % overhead for small functions.
Output for 8.2.7, 8.4.5
unhinted: Elapsed 0.14 seconds hinted: Elapsed 0.17 seconds Type hinting causes 26 % overhead for small functions.
Output for 8.4.4
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.17 seconds Type hinting causes 14 % overhead for small functions.
Output for 8.3.24, 8.4.3
unhinted: Elapsed 0.13 seconds hinted: Elapsed 0.16 seconds Type hinting causes 20 % overhead for small functions.
Output for 8.4.2
unhinted: Elapsed 0.13 seconds hinted: Elapsed 0.16 seconds Type hinting causes 19 % overhead for small functions.
Output for 8.4.1
unhinted: Elapsed 0.14 seconds hinted: Elapsed 0.16 seconds Type hinting causes 16 % overhead for small functions.
Output for 8.3.25
unhinted: Elapsed 0.13 seconds hinted: Elapsed 0.16 seconds Type hinting causes 22 % overhead for small functions.
Output for 8.3.23
unhinted: Elapsed 0.13 seconds hinted: Elapsed 0.16 seconds Type hinting causes 18 % overhead for small functions.
Output for 8.3.22
unhinted: Elapsed 0.14 seconds hinted: Elapsed 0.17 seconds Type hinting causes 19 % overhead for small functions.
Output for 8.3.21
unhinted: Elapsed 0.14 seconds hinted: Elapsed 0.19 seconds Type hinting causes 39 % overhead for small functions.
Output for 8.1.5, 8.1.14, 8.1.21, 8.3.20
unhinted: Elapsed 0.14 seconds hinted: Elapsed 0.17 seconds Type hinting causes 24 % overhead for small functions.
Output for 8.3.18
unhinted: Elapsed 0.17 seconds hinted: Elapsed 0.23 seconds Type hinting causes 36 % overhead for small functions.
Output for 8.3.17
unhinted: Elapsed 0.17 seconds hinted: Elapsed 0.22 seconds Type hinting causes 31 % overhead for small functions.
Output for 8.3.16
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.22 seconds Type hinting causes 40 % overhead for small functions.
Output for 8.1.9, 8.3.15
unhinted: Elapsed 0.16 seconds hinted: Elapsed 0.22 seconds Type hinting causes 41 % overhead for small functions.
Output for 8.3.14
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.20 seconds Type hinting causes 37 % overhead for small functions.
Output for 8.2.5, 8.3.12
unhinted: Elapsed 0.14 seconds hinted: Elapsed 0.18 seconds Type hinting causes 32 % overhead for small functions.
Output for 8.1.6, 8.1.24, 8.2.25, 8.3.0, 8.3.11
unhinted: Elapsed 0.14 seconds hinted: Elapsed 0.18 seconds Type hinting causes 26 % overhead for small functions.
Output for 8.1.33, 8.3.9
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.18 seconds Type hinting causes 24 % overhead for small functions.
Output for 8.3.7
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.17 seconds Type hinting causes 17 % overhead for small functions.
Output for 8.1.3, 8.2.28, 8.3.4
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.18 seconds Type hinting causes 21 % overhead for small functions.
Output for 8.0.15, 8.1.31, 8.2.26, 8.3.3
unhinted: Elapsed 0.14 seconds hinted: Elapsed 0.18 seconds Type hinting causes 24 % overhead for small functions.
Output for 8.2.0, 8.3.2
unhinted: Elapsed 0.14 seconds hinted: Elapsed 0.18 seconds Type hinting causes 34 % overhead for small functions.
Output for 8.1.28, 8.3.1
unhinted: Elapsed 0.14 seconds hinted: Elapsed 0.18 seconds Type hinting causes 25 % overhead for small functions.
Output for 7.4.2, 7.4.22, 8.1.0, 8.2.29
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.19 seconds Type hinting causes 26 % overhead for small functions.
Output for 8.2.27
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.17 seconds Type hinting causes 15 % overhead for small functions.
Output for 8.2.24
unhinted: Elapsed 0.14 seconds hinted: Elapsed 0.17 seconds Type hinting causes 20 % overhead for small functions.
Output for 8.2.22
unhinted: Elapsed 0.14 seconds hinted: Elapsed 0.21 seconds Type hinting causes 49 % overhead for small functions.
Output for 8.2.21
unhinted: Elapsed 0.17 seconds hinted: Elapsed 0.21 seconds Type hinting causes 24 % overhead for small functions.
Output for 8.2.20
unhinted: Elapsed 0.17 seconds hinted: Elapsed 0.24 seconds Type hinting causes 38 % overhead for small functions.
Output for 8.2.19
unhinted: Elapsed 0.16 seconds hinted: Elapsed 0.22 seconds Type hinting causes 31 % overhead for small functions.
Output for 8.2.18
unhinted: Elapsed 0.26 seconds hinted: Elapsed 0.30 seconds Type hinting causes 16 % overhead for small functions.
Output for 8.2.17
unhinted: Elapsed 0.16 seconds hinted: Elapsed 0.21 seconds Type hinting causes 33 % overhead for small functions.
Output for 8.1.23, 8.2.16
unhinted: Elapsed 0.14 seconds hinted: Elapsed 0.19 seconds Type hinting causes 33 % overhead for small functions.
Output for 8.2.15
unhinted: Elapsed 0.14 seconds hinted: Elapsed 0.19 seconds Type hinting causes 31 % overhead for small functions.
Output for 8.1.27, 8.2.14
unhinted: Elapsed 0.14 seconds hinted: Elapsed 0.18 seconds Type hinting causes 23 % overhead for small functions.
Output for 7.4.4, 8.0.25, 8.2.12
unhinted: Elapsed 0.14 seconds hinted: Elapsed 0.19 seconds Type hinting causes 34 % overhead for small functions.
Output for 8.2.11
unhinted: Elapsed 0.14 seconds hinted: Elapsed 0.17 seconds Type hinting causes 27 % overhead for small functions.
Output for 8.2.10
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.20 seconds Type hinting causes 34 % overhead for small functions.
Output for 8.2.9
unhinted: Elapsed 0.13 seconds hinted: Elapsed 0.17 seconds Type hinting causes 31 % overhead for small functions.
Output for 8.0.14, 8.0.16, 8.1.1, 8.2.4, 8.2.6
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.19 seconds Type hinting causes 27 % overhead for small functions.
Output for 8.1.18, 8.2.3
unhinted: Elapsed 0.13 seconds hinted: Elapsed 0.17 seconds Type hinting causes 28 % overhead for small functions.
Output for 8.2.2
unhinted: Elapsed 0.13 seconds hinted: Elapsed 0.18 seconds Type hinting causes 40 % overhead for small functions.
Output for 8.2.1
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.19 seconds Type hinting causes 24 % overhead for small functions.
Output for 8.1.32
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.19 seconds Type hinting causes 22 % overhead for small functions.
Output for 8.1.29
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.17 seconds Type hinting causes 11 % overhead for small functions.
Output for 8.1.26
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.18 seconds Type hinting causes 20 % overhead for small functions.
Output for 8.1.25
unhinted: Elapsed 0.14 seconds hinted: Elapsed 0.17 seconds Type hinting causes 17 % overhead for small functions.
Output for 8.1.22
unhinted: Elapsed 0.14 seconds hinted: Elapsed 0.18 seconds Type hinting causes 31 % overhead for small functions.
Output for 8.1.20
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.15 seconds Type hinting causes 6 % overhead for small functions.
Output for 8.1.19
unhinted: Elapsed 0.14 seconds hinted: Elapsed 0.15 seconds Type hinting causes 13 % overhead for small functions.
Output for 8.1.16 - 8.1.17
unhinted: Elapsed 0.13 seconds hinted: Elapsed 0.16 seconds Type hinting causes 23 % overhead for small functions.
Output for 8.1.13
unhinted: Elapsed 0.14 seconds hinted: Elapsed 0.24 seconds Type hinting causes 68 % overhead for small functions.
Output for 8.1.12
unhinted: Elapsed 0.17 seconds hinted: Elapsed 0.21 seconds Type hinting causes 27 % overhead for small functions.
Output for 8.0.8, 8.1.11
unhinted: Elapsed 0.17 seconds hinted: Elapsed 0.23 seconds Type hinting causes 39 % overhead for small functions.
Output for 8.1.7, 8.1.10
unhinted: Elapsed 0.17 seconds hinted: Elapsed 0.22 seconds Type hinting causes 29 % overhead for small functions.
Output for 8.1.8
unhinted: Elapsed 0.16 seconds hinted: Elapsed 0.20 seconds Type hinting causes 26 % overhead for small functions.
Output for 8.1.4
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.20 seconds Type hinting causes 36 % overhead for small functions.
Output for 8.1.2
unhinted: Elapsed 0.28 seconds hinted: Elapsed 0.20 seconds Fatal error: Uncaught ValueError: Unknown format specifier " " in /in/hOVBp:35 Stack trace: #0 /in/hOVBp(35): printf('No overhead for...', 0.70705136607528) #1 {main} thrown in /in/hOVBp on line 35
Process exited with code 255.
Output for 8.0.30
unhinted: Elapsed 0.14 seconds hinted: Elapsed 0.20 seconds Type hinting causes 36 % overhead for small functions.
Output for 7.4.9, 7.4.11, 8.0.29
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.19 seconds Type hinting causes 25 % overhead for small functions.
Output for 8.0.28
unhinted: Elapsed 0.16 seconds hinted: Elapsed 0.20 seconds Type hinting causes 25 % overhead for small functions.
Output for 8.0.27
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.19 seconds Type hinting causes 31 % overhead for small functions.
Output for 8.0.26
unhinted: Elapsed 0.16 seconds hinted: Elapsed 0.20 seconds Type hinting causes 22 % overhead for small functions.
Output for 8.0.24
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.19 seconds Type hinting causes 29 % overhead for small functions.
Output for 8.0.23
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.20 seconds Type hinting causes 29 % overhead for small functions.
Output for 8.0.22
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.21 seconds Type hinting causes 38 % overhead for small functions.
Output for 8.0.21
unhinted: Elapsed 0.16 seconds hinted: Elapsed 0.20 seconds Type hinting causes 30 % overhead for small functions.
Output for 7.4.0, 8.0.20
unhinted: Elapsed 0.14 seconds hinted: Elapsed 0.19 seconds Type hinting causes 36 % overhead for small functions.
Output for 8.0.19
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.21 seconds Type hinting causes 43 % overhead for small functions.
Output for 8.0.18
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.21 seconds Type hinting causes 41 % overhead for small functions.
Output for 8.0.17
unhinted: Elapsed 0.16 seconds hinted: Elapsed 0.22 seconds Type hinting causes 39 % overhead for small functions.
Output for 8.0.13
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.22 seconds Type hinting causes 48 % overhead for small functions.
Output for 8.0.12
unhinted: Elapsed 0.34 seconds hinted: Elapsed 0.41 seconds Type hinting causes 20 % overhead for small functions.
Output for 8.0.11
unhinted: Elapsed 0.17 seconds hinted: Elapsed 0.23 seconds Type hinting causes 32 % overhead for small functions.
Output for 8.0.10
unhinted: Elapsed 0.17 seconds hinted: Elapsed 0.24 seconds Type hinting causes 39 % overhead for small functions.
Output for 8.0.9
unhinted: Elapsed 0.17 seconds hinted: Elapsed 0.24 seconds Type hinting causes 43 % overhead for small functions.
Output for 8.0.7
unhinted: Elapsed 0.18 seconds hinted: Elapsed 0.27 seconds Type hinting causes 47 % overhead for small functions.
Output for 8.0.6
unhinted: Elapsed 0.18 seconds hinted: Elapsed 0.28 seconds Type hinting causes 51 % overhead for small functions.
Output for 8.0.5
unhinted: Elapsed 0.19 seconds hinted: Elapsed 0.27 seconds Type hinting causes 43 % overhead for small functions.
Output for 8.0.3
unhinted: Elapsed 0.17 seconds hinted: Elapsed 0.27 seconds Type hinting causes 55 % overhead for small functions.
Output for 7.4.24, 8.0.2
unhinted: Elapsed 0.18 seconds hinted: Elapsed 0.25 seconds Type hinting causes 39 % overhead for small functions.
Output for 8.0.1
unhinted: Elapsed 0.19 seconds hinted: Elapsed 0.26 seconds Type hinting causes 38 % overhead for small functions.
Output for 7.4.33
unhinted: Elapsed 0.19 seconds hinted: Elapsed 0.24 seconds Type hinting causes 30 % overhead for small functions.
Output for 7.4.32
unhinted: Elapsed 0.20 seconds hinted: Elapsed 0.23 seconds Type hinting causes 16 % overhead for small functions.
Output for 7.4.30
unhinted: Elapsed 0.19 seconds hinted: Elapsed 0.28 seconds Type hinting causes 43 % overhead for small functions.
Output for 7.4.29
unhinted: Elapsed 0.21 seconds hinted: Elapsed 0.26 seconds Type hinting causes 24 % overhead for small functions.
Output for 7.4.28
unhinted: Elapsed 0.20 seconds hinted: Elapsed 0.28 seconds Type hinting causes 36 % overhead for small functions.
Output for 7.4.27
unhinted: Elapsed 0.21 seconds hinted: Elapsed 0.28 seconds Type hinting causes 33 % overhead for small functions.
Output for 7.4.26
unhinted: Elapsed 0.21 seconds hinted: Elapsed 0.29 seconds Type hinting causes 38 % overhead for small functions.
Output for 7.4.25
unhinted: Elapsed 0.20 seconds hinted: Elapsed 0.27 seconds Type hinting causes 35 % overhead for small functions.
Output for 7.4.23
unhinted: Elapsed 0.18 seconds hinted: Elapsed 0.21 seconds Type hinting causes 13 % overhead for small functions.
Output for 7.4.21
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.21 seconds Type hinting causes 34 % overhead for small functions.
Output for 7.4.20
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.23 seconds Type hinting causes 52 % overhead for small functions.
Output for 7.4.19
unhinted: Elapsed 0.18 seconds hinted: Elapsed 0.26 seconds Type hinting causes 44 % overhead for small functions.
Output for 7.4.18
unhinted: Elapsed 0.18 seconds hinted: Elapsed 0.25 seconds Type hinting causes 35 % overhead for small functions.
Output for 7.4.16
unhinted: Elapsed 0.18 seconds hinted: Elapsed 0.24 seconds Type hinting causes 32 % overhead for small functions.
Output for 7.4.15
unhinted: Elapsed 0.17 seconds hinted: Elapsed 0.25 seconds Type hinting causes 49 % overhead for small functions.
Output for 7.4.14
unhinted: Elapsed 0.20 seconds hinted: Elapsed 0.20 seconds Type hinting causes 2 % overhead for small functions.
Output for 7.4.13
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.20 seconds Type hinting causes 35 % overhead for small functions.
Output for 7.4.12
unhinted: Elapsed 0.16 seconds hinted: Elapsed 0.21 seconds Type hinting causes 35 % overhead for small functions.
Output for 7.4.10
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.19 seconds Type hinting causes 20 % overhead for small functions.
Output for 7.4.8
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.19 seconds Type hinting causes 30 % overhead for small functions.
Output for 7.4.7
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.19 seconds Type hinting causes 28 % overhead for small functions.
Output for 7.4.6
unhinted: Elapsed 0.16 seconds hinted: Elapsed 0.19 seconds Type hinting causes 22 % overhead for small functions.
Output for 7.4.5
unhinted: Elapsed 0.17 seconds hinted: Elapsed 0.19 seconds Type hinting causes 15 % overhead for small functions.
Output for 7.4.3
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.20 seconds Type hinting causes 31 % overhead for small functions.
Output for 7.4.1
unhinted: Elapsed 0.15 seconds hinted: Elapsed 0.19 seconds Type hinting causes 21 % overhead for small functions.

preferences:
106.15 ms | 579 KiB | 5 Q