Re: Pux - High Performance PHP Router

From: Date: Tue, 07 Jan 2014 15:54:41 +0000
Subject: Re: Pux - High Performance PHP Router
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.general 
Request: Send a blank email to php-general+get-322650@lists.php.net to get a copy of this message
On Jan 7, 2014, at 11:37 PM, Sebastian Krebs <krebs.seb@gmail.com> wrote: > > > > 2014/1/7 Lin Yo-an <cornelius.howl@gmail.com> > > > 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 :) I think the minimal case already shows the difference. :) but I think it’s still OK to add more complex test case for “real world” scenarios. > Something veeery different: How easy is it to replace Symfony2s router with your one? If I use > the Symfony2-Router, it is probably not, because it looks nice, but I use it within something > Symfony-HTTP-Kernel based. So even if you one is much much faster, maybe it doesn't help me? > I can imagine, that it is quite easy to implement a Symfony2-Router-class, that just > pass-through the request to your implementation. A benchmark about this would be interesting too: > How much is the speedup in my _existing_ application simply by _replacing_ (and not rewriting too > much) the router? Well, I don’t think you should replace your router if you’re already using Symfony 2. :) and I actually don’t want to make it fully compatible with Symfony 2. Also I can't make sure whether Pux can help you or not. Or tell you how easy is it to replace Symfony 2 Router with Pux, I can’t tell you the answer because I don’t have much experience about using Symfony framework. Pux is an experiment, which is implemented in only few days, to test a my concept - "there is more than one way to do it” and it (routing) can be done smarter & faster. > > > > http://symfony.com/doc/current/book/routing.html#addiAnd saying > this mine is probably fang-requirements > > > > The example below is copied from the README. > > use Pux\Executor; > > class ProductController { > public function listAction() { > return 'product list'; > } > public function itemAction($id) { > return "product $id"; > } > } > $mux = new Pux\Mux; > $mux->add('/product', ['ProductController','listAction']); > $mux->add('/product/:id', ['ProductController','itemAction'] , > [ > 'require' => [ 'id' => '\d+', ], > 'default' => [ 'id' => '1', ] > ]); > $route = $mux->dispatch('/product/1'); > Executor::execute($route); > > > And here comes the example from Symfony/Routing: > > use Symfony\Component\Routing\RouteCollection; > use Symfony\Component\Routing\Route; > > $collection = new RouteCollection(); > $collection->add('blog', new Route('/blog/{page}', array( > '_controller' => 'AcmeBlogBundle:Blog:index', > 'page' => 1, > ), array( > 'page' => '\d+', > ))); > > return $collection; > > > >> >> Also (don't know, what others think) I'd only compare the matching, not the >> setup. Especially because once you use a form of serialized object and for the other you set it up >> programmatically ;) > > it’s not testing setup. if you've checked the dispatch test case (L40-L50 in > https://github.com/c9s/router-benchmark/blob/master/code/dispatch.php) > > it only calls the dispatch method in the iteration block. > >> >> >> >> On Tue, Jan 7, 2014 at 8:46 PM, Lester Caine <lester@lsces.co.uk> wrote: >> >> > Stuart Dallas wrote: >> > >> >> Tedd Sperling wrote: >> >>> >> >>>> >>This reminds me of an oversea's client I had where they >> >>>> >>wanted to >> >>>> enter the American market with their Pet Shampoo. I told them they may >> >>>> want >> >>>> to pick a different domain name, but they insisted that they had properly >> >>>> investigated the market and had made their choice of >> >>>> "smellypet.com". >> >>>> >> >> >>>> >>A year later, they contacted me and said they finally understood >> >>>> >>what >> >>>> I was talking about. >> >>>> >> >>> > >> >>> >FCKEditor is another higher profile example … >> >>> >> >> >>>>http://docs.cksource.com/FCKeditor_3.x/Design_and_Architecture/Rebranding >> >> >> > >> > A good documentation of the problem explaining why what seems like a bit >> > of a joke can backfire? >> > >> > I'm of an age where the Windows DDK came on a stack of floppy disks. It >> > was quite irritating to read some of the jokes and fowl language that were >> > spread through the code. Something that would not be allowed these days as >> > we can all review the code bases. Care in the choice of names is even more >> > important these days? >> > >> > >> > -- >> > Lester Caine - G8HFL >> > ----------------------------- >> > Contact - http://lsces.co.uk/wiki/?page=contact >> > L.S.Caine Electronic Services - http://lsces.co.uk >> > EnquirySolve - http://enquirysolve.com/ >> > Model Engineers Digital Workshop - http://medw.co.uk >> > >> > Rainbow Digital Media - >> > http://rainbowdigitalmedia.co.uk >> > >> > -- >> > PHP General Mailing List (http://www.php.net/) >> > To unsubscribe, visit: http://www.php.net/unsub.php >> > >> > >> >> >> -- >> Best Regards, >> >> Yo-An Lin >> >> >> >> -- >> github.com/KingCrunch > > > > > -- > github.com/KingCrunch

« previous php.general (#322650) next »