|
1 | 1 | # Documentation
|
2 |
| - |
| 2 | + |
3 | 3 | 
|
4 | 4 | 
|
5 | 5 | 
|
|
34 | 34 | $response = new Kosmosx\Response\RestResponse();
|
35 | 35 |
|
36 | 36 | $handler = Kosmosx\Response\Exceptions\Handler();
|
37 |
| - $handler->setExceptionHandler(); |
| 37 | + $handler->setExceptionHandler(); |
| 38 | + |
| 39 | +### Benchmark |
| 40 | + |
| 41 | +Same PC hardware (RAM: 16GB (2x8 GB) DDR4 2133 MHz, CPU: Intel Core i5 7400 Quad Core & 4 Thread 3.0GHz) |
| 42 | + |
| 43 | +**Illuminate/Response** |
| 44 | + |
| 45 | +Response weight 4.26Mb in 158~161ms |
| 46 | + |
| 47 | + $app = array(); |
| 48 | + for ($x = 0; $x <= 1000; $x++) { |
| 49 | + $app[$x] = new JsonResponse(array('data'=>[true,false], "message" => 'Microservice Lumen work', "state" => "OK")); |
| 50 | + } |
| 51 | + return var_dump($app); |
38 | 52 |
|
| 53 | +**Kosmosx/Response** |
| 54 | + |
| 55 | +Response weight 3.6Mb in 148~151ms |
| 56 | + |
| 57 | + $app = array(); |
| 58 | + for ($x = 0; $x <= 1000; $x++) { |
| 59 | + $app[$x] = new RestResponse(array('data'=>[true,false], "message" => 'Microservice Lumen work', "state" => "OK")); |
| 60 | + } |
| 61 | + return var_dump($app); |
| 62 | + |
| 63 | +Response weight 3.6Mb in 220~223ms |
| 64 | + |
| 65 | + $app = array(); |
| 66 | + for ($x = 0; $x <= 1000; $x++) { |
| 67 | + $app[$x] = $this->response->success() |
| 68 | + ->withMessage('Microservice Lumen work') |
| 69 | + ->withData(true) |
| 70 | + ->withData(false) |
| 71 | + ->withState(); |
| 72 | + } |
| 73 | + return var_dump($app); |
| 74 | + |
| 75 | +Results |
| 76 | + |
| 77 | + Kosmosx/Response it is 15.50% smaller than Illuminate |
| 78 | + Kosmosx/Response it is 6.3% faster than Illuminate (if use constructor) |
| 79 | + |
39 | 80 | **en**: [documentation](https://github.com/FabrizioCafolla/response-http/wiki/Response-http-documentation)
|
40 | 81 |
|
41 | 82 | **it**: [documentazione](https://github.com/FabrizioCafolla/response-http/wiki/Documentazione-response-http)
|
|
0 commit comments