Skip to content

Commit daa05d5

Browse files
committed
Revert "v2.0 initial commit"
This reverts commit 5660d41.
1 parent 5660d41 commit daa05d5

File tree

12 files changed

+26
-193
lines changed

12 files changed

+26
-193
lines changed

base/_functions.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ benchmark () {
2020
return 1
2121
fi
2222

23-
config_wrk="wrk -t${threads} -c${connections} -d${duration}s"
23+
config_wrk="wrk -t50 -c1000 -d60s"
2424

2525
# is it wsl!?
2626
# if you're using wsl, it's necessary to put -R (--rate)
@@ -38,10 +38,9 @@ benchmark () {
3838
config_wrk="$config_wrk '$url' > '$output_wrk'"
3939
eval $config_wrk
4040

41-
rps=`grep "Requests/sec:" "$output_wrk" | tr -cd '0-9.'`
41+
rps=`grep "Requests/sec:" "$output_wrk" | tr -dc '0-9.'`
4242

43-
echo "rps: "
44-
numfmt --g "$rps"
43+
numfmt --g "$rps rps"
4544

4645
# to make a small gap between the WRK and CURL
4746
sleep 1
@@ -52,12 +51,12 @@ benchmark () {
5251
# The for (( expr ; expr ; expr )) syntax is not available in sh, so:
5352
while [ $i -lt $count ]
5453
do
55-
curl -sS "$url" > "$output"
54+
curl "$url" > "$output"
5655
t=`tail -1 "$output" | cut -f 2 -d ':'`
57-
total=`php ./libs/sum_ms.php $t $total`
56+
total=`php ./base/sum_ms.php $t $total`
5857
i=$(( $i + 1 ))
5958
done
60-
time=`php ./libs/avg_ms.php $total $count`
59+
time=`php ./base/avg_ms.php $total $count`
6160

6261

6362
# get memory and file
@@ -70,6 +69,7 @@ benchmark () {
7069
grep "Document Length:" "$output_wrk" >> "$check_file"
7170
grep "Failed requests:" "$output_wrk" >> "$check_file"
7271
grep 'Hello World!' "$output" >> "$check_file"
72+
echo "---" >> "$check_file"
7373

7474
# check errors
7575
touch "$error_file"
File renamed without changes.

base/hello_world.sh

Lines changed: 4 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
cd `dirname $0`
44
. ./_functions.sh
5-
. ../benchmark.config
65

6+
base="$1"
77
bm_name=`basename $0 .sh`
88

99
results_file="output/results.$bm_name.log"
@@ -22,57 +22,13 @@ mv "$url_file" "$url_file.old"
2222
phpv=`php -r 'echo phpversion();'`
2323
echo "/------- PHP $phpv -------/"
2424

25-
for fw in `echo $param_targets`
25+
for fw in `echo $targets`
2626
do
2727
if [ -d "$fw" ]; then
28-
echo "/------- $fw -------/"
29-
30-
# read -p "Continue to $fw (y/n)?" choice
31-
# case "$choice" in
32-
# y|Y ) echo "yes";;
33-
# n|N ) echo "no";;
34-
# * ) echo "invalid";;
35-
# esac
36-
# if [ "$choice" = "n" ] || [ "$choice" = "N" ]; then
37-
# continue
38-
# fi
39-
40-
if [ "$param_clean" = true ]; then
41-
bash clean.sh
42-
bash setup.sh "$fw"
43-
fi
44-
45-
# read -p "Continue to benchmark (y/n)?" choice
46-
# case "$choice" in
47-
# y|Y ) echo "yes";;
48-
# * ) echo "invalid";;
49-
# esac
50-
# if [ "$choice" = "n" ] || [ "$choice" = "N" ]; then
51-
# continue
52-
# fi
53-
54-
# reset the opcache
28+
echo "/------- $fw: benchmarking -------/"
29+
echo "$fw/_benchmark/hello_world.sh"
5530
php ./libs/reset_opcache.php
56-
57-
if [ "$param_restart_apache" = true ]; then
58-
echo 'systemctl restart apache2'
59-
sudo systemctl restart apache2
60-
fi
61-
62-
if [ "$param_restart_nginx" = true ]; then
63-
echo 'systemctl restart nginx'
64-
sudo systemctl restart nginx
65-
fi
66-
67-
# a small gap between composer, reset_opcache, webserver restarted and benchmark
68-
sleep 2
69-
70-
# get the hello world link
7131
. "$fw/_benchmark/hello_world.sh"
72-
73-
echo "/------- $fw: benchmarking -------/"
74-
75-
# run the benchmark
7632
benchmark "$fw" "$url"
7733
fi
7834
done

base/show_fw_array.sh

Lines changed: 0 additions & 19 deletions
This file was deleted.
File renamed without changes.

benchmark.config

Lines changed: 0 additions & 14 deletions
This file was deleted.

benchmark.sh

Lines changed: 13 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,27 @@
11
#!/bin/sh
22

3-
if [ ! `which php` ]; then
4-
echo "php not found."
5-
exit 1;
6-
fi
7-
83
if [ ! `which wrk` ]; then
9-
echo "WRK not found."
4+
echo "wrk not found."
105
exit 1;
116
fi
127

138
if [ ! `which curl` ]; then
14-
echo "CURL not found."
9+
echo "curl not found."
1510
exit 1;
1611
fi
1712

18-
function showHelp()
19-
{
20-
cat << HEREDOC
21-
22-
Usage: bash benchmark.sh [-c] [-rapache] [-t pure-php laravel-10]
13+
base="http://127.0.0.1/php-frameworks-bench"
2314

24-
Optional Arguments:
25-
-c, --clean NUM Clean all frameworks and install the target framework -fresh install- before benchmark.
26-
-h, --help Show this help message and exit
27-
-rapache, --restart-apache Restart apache "sudo systemctl restart apache2" before each benchmark.
28-
-rnginx, --restart-nginx Restart apache "sudo systemctl restart nginx" before each benchmark.
29-
-t, --targets Specify your target frameworks for benchmarking.
30-
31-
HEREDOC
32-
}
33-
34-
. ./list.sh
35-
export param_targets="$list"
36-
export param_clean=false
37-
export param_restart_apache=false
38-
export param_restart_nginx=false
39-
40-
insputs=" ${@%/}"
41-
IFS=';'
42-
params=(`php ./libs/strreplace.php " -" ";-" " ${insputs}"`)
15+
if [ $# -eq 0 ]; then
16+
# include frameworks list
17+
. ./list.sh
18+
export targets="$list"
19+
else
20+
export targets="${@%/}"
21+
fi
4322

44-
for option in "${params[@]}"
45-
do
46-
case "$option" in
47-
-c|--clean)
48-
param_clean=true
49-
;;
50-
-rapache|--restart-apache)
51-
param_restart_apache=true
52-
;;
53-
-rnginx|--restart-nginx)
54-
param_restart_nginx=true
55-
;;
56-
-t*|--targets*)
57-
arg_=${option//--targets /}
58-
arg_=${arg_//-t /}
59-
param_targets="$arg_"
60-
;;
61-
-h|--help)
62-
showHelp;
63-
;;
64-
" ")
65-
;;
66-
*)
67-
echo "${option} not available"
68-
;;
69-
esac
70-
done
23+
cd base
7124

72-
sh ./base/hello_world.sh
25+
sh hello_world.sh "$base"
7326

74-
php ./libs/show_results_table.php
27+
php ../bin/show_results_table.php

index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
<hr>
8888

8989
<footer>
90-
<p style="text-align: right">This page is a part of <a href="https://github.com/myaaghubi/PHP-Frameworks-Bench">PHP-Frameworks-Bench</a>.</p>
90+
<p style="text-align: right">This page is a part of <a href="https://github.com/myaghobi/php-frameworks-bench">php-frameworks-bench</a>.</p>
9191
</footer>
9292
</body>
9393
</html>

libs/show_comparison_table.php

Lines changed: 0 additions & 28 deletions
This file was deleted.

libs/show_results_table.php

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)