Re: Pux - High Performance PHP Router

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I also tested your case "php array as a router”.

the php array test case is the fastest because there is no any function call. but using php array to route does not help the development and it’s hard to maintain or extend:

                     Rate   Mem php array pux extension aura ham symfony/routing klein
      php array 186.61K/s    0B        --          -69% -21% -8%             -1%   -1%
  pux extension  129.4K/s    0B      144%            -- -31%-12%             -1%   -1%
           aura  40.26K/s    0B      463%          321%   ---41%             -5%   -4%
            ham  16.74K/s    0B     1114%          773% 240%  --            -12%  -11%
symfony/routing   2.07K/s  524K     9012%         6249%1944%808%              --  -91%
          klein   1.89K/s  262K     9861%         6838%2127%884%            109%    --

note that there is only 1.3~1.4x different between plain php array and pux.

code - PHP Array as Router:

// plain php
$phparray = array(
    '/hello' => array( 'hello' )
);
$bench->iterate( 'php array' , function() use ($phparray) {
    if ( isset($phparray['/hello']) ) {
        $route = $phparray['/hello'];
    }
});



c9s
http://github.com/c9s


On Jan 9, 2014, at 3:40 PM, Lin Yo-an <cornelius.howl@xxxxxxxxx> wrote:

> 
> On Jan 7, 2014, at 11:37 PM, Sebastian Krebs <krebs.seb@xxxxxxxxx> wrote:
> 
>> 2014/1/7 Lin Yo-an <cornelius.howl@xxxxxxxxx>
>> 
>> 
>> Thats what I wanted to tell you: You benchmark a single, very trivial case. For this case (as mentioned) I don't need a router at all, but thats not the point of a router. Of course both implementations can do more and thats what most interest: How do they behave in something similar to "real world" scenarios :)
> 
> If the minimal test case does not show the different, then we will need a complex sample to test them.
> 
> The minimal test case already shows the huge difference, so there is no much need to test a complex test case actually.
> 
> I added more benchmarks for Klein.php, Ham, and Aura. 
> 
> Aura is the second fastest router. but Pux is still faster 2.5x than Aura router:
> 
> https://github.com/c9s/router-benchmark/blob/master/code/dispatch.txt


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux