Demo of finfo performance in php 7.2 vs 7.3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
ITERS=${1:-1000} | |
echo "Testing finfo over $ITERS iterations" | |
for VER in '7.2' '7.3'; do | |
echo --- | |
echo "Testing PHP $VER" | |
docker run -i \ | |
-e "ITERS=${ITERS}" \ | |
php:${VER}-cli-alpine php <<'EOF' | |
<?php | |
$iters = $_ENV["ITERS"]; | |
$start = microtime(true); | |
for ($i = 1; $i <= $iters; $i++){ | |
$finfo = new finfo(FILEINFO_MIME); | |
$type = $finfo->file("/bin/sh"); | |
unset($finfo); | |
} | |
$ttl = microtime(true) - $start; | |
echo "Took: $ttl\n"; | |
?> | |
EOF | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment