Skip to content

Instantly share code, notes, and snippets.

@mgttt
Created April 17, 2016 04:28
Show Gist options
  • Save mgttt/af429dba0015b5ba57c3d16dd1f46c49 to your computer and use it in GitHub Desktop.
Save mgttt/af429dba0015b5ba57c3d16dd1f46c49 to your computer and use it in GitHub Desktop.
# test loading time of php, and Result:
# php5.5/macos(come with apache bundle)/-opcache: around 120 ms
# php70/+opcache/macos(brew):
# case 1, php -r, around 15ms
# case 2, php test_php_launch_time.php, around 18-20ms
nano=`date +%N`
echo nano=$nano
if [ "$nano" == "N" ];
then
#echo " date +%N not working, please [brew install coreutils] and run [gdate] instead "
echo "WARNING: date +%N not working, trying use gdate ( brew install coreutils && gdate ): "
date="gdate"
fi
mytime=`$date +%s.%N`
echo mytime=$mytime
php -r "\$php_micro_time=microtime(true);\$sys_micro_time=\$argv[1];print \$php_micro_time.\"\\n\".\$sys_micro_time.\"\\n\";" $mytime
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment