3v4l.org

run code in 300+ PHP versions simultaneously
<?php class X { protected $val = []; function notempty() { return ! empty( $this->val ); } function booltest() { return (bool) $this->val; } } $its = 1e3; $x = new X; $t = hrtime(true); for ($i=0;$i++<$its;) $x->notempty(); echo (hrtime(true)-$t)/1e9,"s\n"; $t = hrtime(true); for ($i=0;$i++<$its;) $x->booltest(); echo (hrtime(true)-$t)/1e9,"s\n"; echo "\n=== Warmed up ===\n\n"; $its = 1e5; $t = hrtime(true); for ($i=0;$i++<$its;) $x->notempty(); echo 'notempty: ', $a=(hrtime(true)-$t)/1e9,"s\n"; $t = hrtime(true); for ($i=0;$i++<$its;) $x->booltest(); echo 'bool : ', $b=(hrtime(true)-$t)/1e9,"s\n"; echo 'bool is ', number_format((($a-$b)/$a) * 100, 2 ), "% faster than notempty chain\n";
Output for 8.5.1
0.000122735s 5.0207E-5s === Warmed up === notempty: 0.005933733s bool : 0.005079204s bool is 14.40% faster than notempty chain
Output for 8.5.0
5.914E-5s 5.942E-5s === Warmed up === notempty: 0.005109693s bool : 0.004972804s bool is 2.68% faster than notempty chain
Output for 8.4.16
5.1938E-5s 4.5629E-5s === Warmed up === notempty: 0.005053828s bool : 0.004601926s bool is 8.94% faster than notempty chain
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.
Output for 8.4.14
4.693E-5s 4.019E-5s === Warmed up === notempty: 0.004727363s bool : 0.003911344s bool is 17.26% faster than notempty chain
Output for 8.4.13
4.0461E-5s 5.5039E-5s === Warmed up === notempty: 0.003568023s bool : 0.002374068s bool is 33.46% faster than notempty chain
Output for 8.4.12
3.325E-5s 3.707E-5s === Warmed up === notempty: 0.003227272s bool : 0.002419206s bool is 25.04% faster than notempty chain
Output for 8.4.11
3.3371E-5s 3.375E-5s === Warmed up === notempty: 0.00315209s bool : 0.002415903s bool is 23.36% faster than notempty chain
Output for 8.4.10
3.912E-5s 3.093E-5s === Warmed up === notempty: 0.003580378s bool : 0.00313194s bool is 12.52% faster than notempty chain
Output for 8.4.9
4.045E-5s 3.0059E-5s === Warmed up === notempty: 0.003835964s bool : 0.00298968s bool is 22.06% faster than notempty chain
Output for 8.4.8
5.111E-5s 2.887E-5s === Warmed up === notempty: 0.002967578s bool : 0.002387742s bool is 19.54% faster than notempty chain
Output for 8.4.7
1.975E-5s 2.4259E-5s === Warmed up === notempty: 0.001823743s bool : 0.001676804s bool is 8.06% faster than notempty chain
Output for 8.4.6
1.978E-5s 1.606E-5s === Warmed up === notempty: 0.001884769s bool : 0.001552523s bool is 17.63% faster than notempty chain
Output for 8.4.5
3.2709E-5s 1.596E-5s === Warmed up === notempty: 0.001809391s bool : 0.001598381s bool is 11.66% faster than notempty chain
Output for 8.4.4
3.4159E-5s 1.9969E-5s === Warmed up === notempty: 0.001777651s bool : 0.00177001s bool is 0.43% faster than notempty chain
Output for 8.4.3
3.717E-5s 3.0911E-5s === Warmed up === notempty: 0.00357919s bool : 0.003047485s bool is 14.86% faster than notempty chain
Output for 8.4.2
5.1851E-5s 6.71E-5s === Warmed up === notempty: 0.005218401s bool : 0.004361889s bool is 16.41% faster than notempty chain
Output for 8.4.1
2.288E-5s 1.592E-5s === Warmed up === notempty: 0.001791688s bool : 0.001536482s bool is 14.24% faster than notempty chain
Output for 8.3.29
8.7261E-5s 6.6131E-5s === Warmed up === notempty: 0.005594586s bool : 0.004795482s bool is 14.28% faster than notempty chain
Output for 8.3.28
5.852E-5s 4.568E-5s === Warmed up === notempty: 0.004999474s bool : 0.004261744s bool is 14.76% faster than notempty chain
Output for 8.3.27
5.563E-5s 5.496E-5s === Warmed up === notempty: 0.004634173s bool : 0.003981824s bool is 14.08% faster than notempty chain
Output for 8.3.26
6.4659E-5s 2.792E-5s === Warmed up === notempty: 0.003659179s bool : 0.002783845s bool is 23.92% faster than notempty chain
Output for 8.3.25
5.261E-5s 2.859E-5s === Warmed up === notempty: 0.003591228s bool : 0.002824913s bool is 21.34% faster than notempty chain
Output for 8.3.24
2.278E-5s 1.851E-5s === Warmed up === notempty: 0.001487869s bool : 0.001115953s bool is 25.00% faster than notempty chain
Output for 8.3.23
5.219E-5s 2.835E-5s === Warmed up === notempty: 0.003572676s bool : 0.002843231s bool is 20.42% faster than notempty chain
Output for 8.3.22
2.558E-5s 1.792E-5s === Warmed up === notempty: 0.001503911s bool : 0.001119335s bool is 25.57% faster than notempty chain
Output for 8.3.21
7.4509E-5s 6.1789E-5s === Warmed up === notempty: 0.004663906s bool : 0.004311659s bool is 7.55% faster than notempty chain
Output for 8.3.20
2.382E-5s 1.6609E-5s === Warmed up === notempty: 0.001783512s bool : 0.001584323s bool is 11.17% faster than notempty chain
Output for 8.3.19
8.9479E-5s 6.534E-5s === Warmed up === notempty: 0.004702105s bool : 0.003906579s bool is 16.92% faster than notempty chain
Output for 8.3.18
5.592E-5s 6.1609E-5s === Warmed up === notempty: 0.004749921s bool : 0.003841735s bool is 19.12% faster than notempty chain
Output for 8.3.17
5.608E-5s 3.873E-5s === Warmed up === notempty: 0.00457231s bool : 0.003962373s bool is 13.34% faster than notempty chain
Output for 8.3.16
5.585E-5s 3.982E-5s === Warmed up === notempty: 0.004685851s bool : 0.003826435s bool is 18.34% faster than notempty chain
Output for 8.3.15
7.256E-5s 5.883E-5s === Warmed up === notempty: 0.0043221s bool : 0.003114475s bool is 27.94% faster than notempty chain
Output for 8.3.14
5.5099E-5s 5.955E-5s === Warmed up === notempty: 0.004467659s bool : 0.003974785s bool is 11.03% faster than notempty chain
Output for 8.3.13
3.3109E-5s 1.6184E-5s === Warmed up === notempty: 0.001906435s bool : 0.001540445s bool is 19.20% faster than notempty chain
Output for 8.3.12
3.322E-5s 2.2734E-5s === Warmed up === notempty: 0.001873736s bool : 0.00158419s bool is 15.45% faster than notempty chain
Output for 8.3.11
2.3736E-5s 1.5903E-5s === Warmed up === notempty: 0.001763541s bool : 0.001529878s bool is 13.25% faster than notempty chain
Output for 8.3.10
2.4157E-5s 1.5943E-5s === Warmed up === notempty: 0.001926145s bool : 0.001572954s bool is 18.34% faster than notempty chain
Output for 8.3.9
2.3935E-5s 2.3886E-5s === Warmed up === notempty: 0.00180082s bool : 0.001519847s bool is 15.60% faster than notempty chain
Output for 8.3.8
2.8704E-5s 2.2031E-5s === Warmed up === notempty: 0.002165084s bool : 0.00213s bool is 1.62% faster than notempty chain
Output for 8.3.7
4.2373E-5s 2.8923E-5s === Warmed up === notempty: 0.003357071s bool : 0.002846649s bool is 15.20% faster than notempty chain
Output for 8.3.6
6.2614E-5s 4.3345E-5s === Warmed up === notempty: 0.005188625s bool : 0.004397733s bool is 15.24% faster than notempty chain
Output for 8.3.5
4.3756E-5s 2.9414E-5s === Warmed up === notempty: 0.003313435s bool : 0.002774572s bool is 16.26% faster than notempty chain
Output for 8.3.4
3.6144E-5s 2.9875E-5s === Warmed up === notempty: 0.003343557s bool : 0.002872057s bool is 14.10% faster than notempty chain
Output for 8.3.3
3.5924E-5s 3.0967E-5s === Warmed up === notempty: 0.00329821s bool : 0.002831448s bool is 14.15% faster than notempty chain
Output for 8.3.2
4.7451E-5s 5.7908E-5s === Warmed up === notempty: 0.004475164s bool : 0.004009383s bool is 10.41% faster than notempty chain
Output for 8.3.1
4.7571E-5s 5.284E-5s === Warmed up === notempty: 0.004486111s bool : 0.004016864s bool is 10.46% faster than notempty chain
Output for 8.3.0
4.653E-5s 3.266E-5s === Warmed up === notempty: 0.003640198s bool : 0.003165794s bool is 13.03% faster than notempty chain
Output for 8.2.30
5.976E-5s 5.243E-5s === Warmed up === notempty: 0.005310758s bool : 0.004781911s bool is 9.96% faster than notempty chain
Output for 8.2.29
4.3389E-5s 2.853E-5s === Warmed up === notempty: 0.003958853s bool : 0.0029117s bool is 26.45% faster than notempty chain
Output for 8.2.28
4.6629E-5s 5.878E-5s === Warmed up === notempty: 0.004727364s bool : 0.004081578s bool is 13.66% faster than notempty chain
Output for 8.2.27
4.855E-5s 5.8879E-5s === Warmed up === notempty: 0.004470072s bool : 0.003917724s bool is 12.36% faster than notempty chain
Output for 8.2.26
3.7571E-5s 4.797E-5s === Warmed up === notempty: 0.003720819s bool : 0.003037457s bool is 18.37% faster than notempty chain
Output for 8.2.25
1.995E-5s 3.4471E-5s === Warmed up === notempty: 0.001835526s bool : 0.001569127s bool is 14.51% faster than notempty chain
Output for 8.2.24
2.0761E-5s 2.2794E-5s === Warmed up === notempty: 0.001811683s bool : 0.00151219s bool is 16.53% faster than notempty chain
Output for 8.2.23
1.983E-5s 1.5843E-5s === Warmed up === notempty: 0.001781636s bool : 0.001483125s bool is 16.75% faster than notempty chain
Output for 8.2.22
1.944E-5s 1.5633E-5s === Warmed up === notempty: 0.001836248s bool : 0.001527002s bool is 16.84% faster than notempty chain
Output for 8.2.21
5.7536E-5s 5.7586E-5s === Warmed up === notempty: 0.001860311s bool : 0.001608852s bool is 13.52% faster than notempty chain
Output for 8.2.20
2.3395E-5s 3.5217E-5s === Warmed up === notempty: 0.002237331s bool : 0.001806133s bool is 19.27% faster than notempty chain
Output for 8.2.19
4.029E-5s 3.0456E-5s === Warmed up === notempty: 0.003565395s bool : 0.00294549s bool is 17.39% faster than notempty chain
Output for 8.2.18
5.277E-5s 0.000122314s === Warmed up === notempty: 0.005209244s bool : 0.004724914s bool is 9.30% faster than notempty chain
Output for 8.2.17
4.5089E-5s 2.9555E-5s === Warmed up === notempty: 0.003494145s bool : 0.002988364s bool is 14.48% faster than notempty chain
Output for 8.2.16
4.5118E-5s 3.5934E-5s === Warmed up === notempty: 0.004408732s bool : 0.003521687s bool is 20.12% faster than notempty chain
Output for 8.2.15
3.9299E-5s 4.8733E-5s === Warmed up === notempty: 0.003833129s bool : 0.003027135s bool is 21.03% faster than notempty chain
Output for 8.2.14
3.9169E-5s 3.1126E-5s === Warmed up === notempty: 0.003579297s bool : 0.003113406s bool is 13.02% faster than notempty chain
Output for 8.2.13
3.9429E-5s 3.2008E-5s === Warmed up === notempty: 0.003688171s bool : 0.003107245s bool is 15.75% faster than notempty chain
Output for 8.2.12
2.5128E-5s 1.5874E-5s === Warmed up === notempty: 0.001783033s bool : 0.001479496s bool is 17.02% faster than notempty chain
Output for 8.2.11
2.5177E-5s 2.3746E-5s === Warmed up === notempty: 0.0018665s bool : 0.001546637s bool is 17.14% faster than notempty chain
Output for 8.2.10
2.4527E-5s 1.5763E-5s === Warmed up === notempty: 0.001770484s bool : 0.001480097s bool is 16.40% faster than notempty chain
Output for 8.2.9
2.5078E-5s 1.5924E-5s === Warmed up === notempty: 0.001755582s bool : 0.001553687s bool is 11.50% faster than notempty chain
Output for 8.2.8
2.5428E-5s 2.3706E-5s === Warmed up === notempty: 0.001763905s bool : 0.001615591s bool is 8.41% faster than notempty chain
Output for 8.2.7
2.5338E-5s 2.3836E-5s === Warmed up === notempty: 0.001803735s bool : 0.001623153s bool is 10.01% faster than notempty chain
Output for 8.2.6
2.5819E-5s 2.3375E-5s === Warmed up === notempty: 0.001790244s bool : 0.001489642s bool is 16.79% faster than notempty chain
Output for 8.2.5
2.6319E-5s 1.6054E-5s === Warmed up === notempty: 0.001783774s bool : 0.001580188s bool is 11.41% faster than notempty chain
Output for 8.2.4
2.5729E-5s 2.4477E-5s === Warmed up === notempty: 0.001864996s bool : 0.001504995s bool is 19.30% faster than notempty chain
Output for 8.2.3
2.4998E-5s 2.4026E-5s === Warmed up === notempty: 0.001841732s bool : 0.001549321s bool is 15.88% faster than notempty chain
Output for 8.2.2
2.634E-5s 2.4076E-5s === Warmed up === notempty: 0.001777596s bool : 0.001553989s bool is 12.58% faster than notempty chain
Output for 8.2.1
2.8744E-5s 1.5934E-5s === Warmed up === notempty: 0.001831175s bool : 0.001476241s bool is 19.38% faster than notempty chain
Output for 8.2.0
2.5699E-5s 1.6205E-5s === Warmed up === notempty: 0.001826729s bool : 0.001592576s bool is 12.82% faster than notempty chain
Output for 8.1.34
3.3521E-5s 2.4497E-5s === Warmed up === notempty: 0.002602623s bool : 0.002459007s bool is 5.52% faster than notempty chain
Output for 8.1.33
3.0359E-5s 1.849E-5s === Warmed up === notempty: 0.001798169s bool : 0.001276022s bool is 29.04% faster than notempty chain
Output for 8.1.32
4.689E-5s 3.8789E-5s === Warmed up === notempty: 0.004677123s bool : 0.004031819s bool is 13.80% faster than notempty chain
Output for 8.1.31
4.8558E-5s 3.9128E-5s === Warmed up === notempty: 0.004396745s bool : 0.003833691s bool is 12.81% faster than notempty chain
Output for 8.1.30
2.014E-5s 1.5844E-5s === Warmed up === notempty: 0.001921838s bool : 0.001615416s bool is 15.94% faster than notempty chain
Output for 8.1.29
2.2872E-5s 3.3984E-5s === Warmed up === notempty: 0.002193768s bool : 0.001785664s bool is 18.60% faster than notempty chain
Output for 8.1.28
4.5138E-5s 4.3795E-5s === Warmed up === notempty: 0.003261696s bool : 0.002835934s bool is 13.05% faster than notempty chain
Output for 8.1.27
2.0982E-5s 2.3936E-5s === Warmed up === notempty: 0.001834271s bool : 0.001620408s bool is 11.66% faster than notempty chain
Output for 8.1.26
2.5728E-5s 1.6194E-5s === Warmed up === notempty: 0.001830294s bool : 0.001616543s bool is 11.68% faster than notempty chain
Output for 8.1.25
2.0922E-5s 2.4888E-5s === Warmed up === notempty: 0.001896233s bool : 0.001518024s bool is 19.95% faster than notempty chain
Output for 8.1.24
2.5389E-5s 2.4446E-5s === Warmed up === notempty: 0.001803314s bool : 0.001552606s bool is 13.90% faster than notempty chain
Output for 8.1.23
2.5128E-5s 1.5814E-5s === Warmed up === notempty: 0.001777435s bool : 0.001583453s bool is 10.91% faster than notempty chain
Output for 8.1.22
2.5229E-5s 1.5853E-5s === Warmed up === notempty: 0.001844856s bool : 0.001531775s bool is 16.97% faster than notempty chain
Output for 8.1.21
2.4978E-5s 1.5854E-5s === Warmed up === notempty: 0.001841652s bool : 0.001497984s bool is 18.66% faster than notempty chain
Output for 8.1.20
2.4978E-5s 1.5904E-5s === Warmed up === notempty: 0.001818887s bool : 0.00154804s bool is 14.89% faster than notempty chain
Output for 8.1.19
2.5158E-5s 2.1492E-5s === Warmed up === notempty: 0.00184039s bool : 0.001657325s bool is 9.95% faster than notempty chain
Output for 8.1.18
3.4011E-5s 2.3615E-5s === Warmed up === notempty: 0.002567604s bool : 0.002380132s bool is 7.30% faster than notempty chain
Output for 8.1.17
2.7151E-5s 2.2845E-5s === Warmed up === notempty: 0.001813659s bool : 0.001566696s bool is 13.62% faster than notempty chain
Output for 8.1.16
2.5118E-5s 2.2173E-5s === Warmed up === notempty: 0.001836675s bool : 0.001521489s bool is 17.16% faster than notempty chain
Output for 8.1.15
2.9725E-5s 2.3335E-5s === Warmed up === notempty: 0.001828001s bool : 0.001577734s bool is 13.69% faster than notempty chain
Output for 8.1.14
2.4987E-5s 1.5914E-5s === Warmed up === notempty: 0.001846068s bool : 0.001553979s bool is 15.82% faster than notempty chain
Output for 8.1.13
2.5187E-5s 1.5824E-5s === Warmed up === notempty: 0.001800149s bool : 0.001511745s bool is 16.02% faster than notempty chain
Output for 8.1.12
3.4963E-5s 2.2924E-5s === Warmed up === notempty: 0.002555856s bool : 0.002266301s bool is 11.33% faster than notempty chain
Output for 8.1.11
2.4948E-5s 1.6675E-5s === Warmed up === notempty: 0.00185387s bool : 0.001517994s bool is 18.12% faster than notempty chain
Output for 8.1.10
2.5709E-5s 1.5985E-5s === Warmed up === notempty: 0.001888551s bool : 0.001493337s bool is 20.93% faster than notempty chain
Output for 8.1.9
2.5268E-5s 2.3225E-5s === Warmed up === notempty: 0.001821391s bool : 0.001503112s bool is 17.47% faster than notempty chain
Output for 8.1.8
2.4326E-5s 2.2855E-5s === Warmed up === notempty: 0.001807039s bool : 0.00157551s bool is 12.81% faster than notempty chain
Output for 8.1.7
2.5519E-5s 2.3014E-5s === Warmed up === notempty: 0.001797785s bool : 0.001537324s bool is 14.49% faster than notempty chain
Output for 8.1.6
4.0031E-5s 2.9184E-5s === Warmed up === notempty: 0.003134226s bool : 0.00287133s bool is 8.39% faster than notempty chain
Output for 8.1.5
2.4948E-5s 2.3045E-5s === Warmed up === notempty: 0.001881s bool : 0.001545095s bool is 17.86% faster than notempty chain
Output for 8.1.4
2.4667E-5s 1.5754E-5s === Warmed up === notempty: 0.001823404s bool : 0.001504224s bool is 17.50% faster than notempty chain
Output for 8.1.3
2.4417E-5s 2.3155E-5s === Warmed up === notempty: 0.001803204s bool : 0.001497724s bool is 16.94% faster than notempty chain
Output for 8.1.2
2.5479E-5s 1.5984E-5s === Warmed up === notempty: 0.001810564s bool : 0.001519847s bool is 16.06% faster than notempty chain
Output for 8.1.1
2.4987E-5s 2.1893E-5s === Warmed up === notempty: 0.001822432s bool : 0.00154778s bool is 15.07% faster than notempty chain
Output for 8.1.0
2.5398E-5s 1.5813E-5s === Warmed up === notempty: 0.001863915s bool : 0.001547108s bool is 17.00% faster than notempty chain

preferences:
121.29 ms | 574 KiB | 5 Q