Skip to content

Commit 8cdf71b

Browse files
committed
Add benchmarking
1 parent 440e4af commit 8cdf71b

File tree

7 files changed

+525
-3
lines changed

7 files changed

+525
-3
lines changed

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,20 @@ You can expect to reduce the latency of outgoing requests by 2 times the latency
2828

2929
For example if you have a server with a 100ms roundtrip latency, and the endpoint takes 100ms to execute, then you are likely to see a speedup from 400ms to 200ms.
3030

31+
## Benchmarks
32+
See tests/Benchmark for a simple PHPBench setup that pings github.com/robots.txt 50 times with and without the package. With the package, a prewarmed curl handle is used.
33+
34+
```
35+
+-----------------+------------------------------------+----------+----------+----------+----------+--------+---------+
36+
| benchmark | subject | memory | min | max | mode | rstdev | stdev |
37+
+-----------------+------------------------------------+----------+----------+----------+----------+--------+---------+
38+
| HttpReusedBench | benchHttpWithReusedCurlHandle () | 16.448mb | 25.870ms | 25.870ms | 25.870ms | ±0.00% | 0.000μs |
39+
| HttpBench | benchHttpWithoutServiceProvider () | 16.411mb | 76.186ms | 76.186ms | 76.186ms | ±0.00% | 0.000μs |
40+
+-----------------+------------------------------------+----------+----------+----------+----------+--------+---------+
41+
42+
```
43+
44+
3145
## See also
3246
Aaron Francis has covered this topic in a video on his YouTube channel, where he explains the performance benefits of reusing curl handles in Laravel Octane. You can watch the video here:
3347
https://www.youtube.com/watch?v=BWAocgJVCbw

composer.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
"Cego\\CurlHandleReuseLaravelOctane\\": "src/"
99
}
1010
},
11+
"autoload-dev": {
12+
"psr-4": {
13+
"Cego\\CurlHandleReuseLaravelOctane\\Tests\\": "tests/"
14+
}
15+
},
1116
"authors": [
1217
{
1318
"name": "Lau Josefsen",
@@ -31,6 +36,7 @@
3136
"phpunit/phpunit": "^11.5",
3237
"orchestra/testbench": "^9.6",
3338
"cego/phpstan": "^4.0",
34-
"cego/php-cs-fixer": "^2.0"
39+
"cego/php-cs-fixer": "^2.0",
40+
"phpbench/phpbench": "^1.3"
3541
}
3642
}

0 commit comments

Comments
 (0)