2014/1/7 Lin Yo-an <cornelius.howl@xxxxxxxxx> > > On Jan 7, 2014, at 10:32 PM, Sebastian Krebs <krebs.seb@xxxxxxxxx> wrote: > > 2014/1/7 Lin Yo-An <cornelius.howl@xxxxxxxxx> > > I can provide a router, that is even faster: > > $routes = [ > '/hello' => ['foo', 'bar'] > ]; > > if (isset($routes['/hello']) { > do_something($routes['/hello']); > } > > > I couldn't resist :) > > > Of course you can do that. I can’t stop you. > > but your route only works for very simple case. > > Pux can do more complex pattern routing just like Symfony/Routing. > 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 you’ve read the readme file carefully, you should have knew that Pux > can let you define path requirement and default value very easily, so you > don’t need to write complex patterns by hands. > > for example, the Pux pattern compiler support the slug & requirement > feature just like Symfony/Routing, but Pux provides a better performance. > 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? > > http://symfony.com/doc/current/book/routing.html#addiAnd saying this mine > is probably fang-requirements<http://symfony.com/doc/current/book/routing.html#adding-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@xxxxxxxxxxx> 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