Skip to content

Instantly share code, notes, and snippets.

@JanTvrdik
Created October 26, 2014 16:31
Show Gist options
  • Select an option

  • Save JanTvrdik/5e67f2ae4ad101027a5b to your computer and use it in GitHub Desktop.

Select an option

Save JanTvrdik/5e67f2ae4ad101027a5b to your computer and use it in GitHub Desktop.
StaticRouter benchmark

Benchmark for Nextras\StaticRouter

Source code

Test __construct:
  StaticRouter                21 ms         +0 %
  Route + RouteList         1392 ms      +6529 %
  Route + global filter      244 ms      +1062 %

Test match-first:
  StaticRouter                65 ms         +0 %
  Route + RouteList          187 ms       +188 %
  Route + global filter      208 ms       +220 %

Test match-last:
  StaticRouter                93 ms         +0 %
  Route + RouteList         1068 ms      +1048 %
  Route + global filter      237 ms       +155 %

Test match-invalid:
  StaticRouter                45 ms         +0 %
  Route + RouteList          989 ms      +2098 %
  Route + global filter      183 ms       +307 %

Test constructUrl-first:
  StaticRouter                18 ms         +0 %
  Route + RouteList           83 ms       +361 %
  Route + global filter      135 ms       +650 %

Test constructUrl-last:
  StaticRouter                18 ms         +0 %
  Route + RouteList          179 ms       +894 %
  Route + global filter      133 ms       +639 %

Test constructUrl-invalid:
  StaticRouter                10 ms         +0 %
  Route + RouteList            9 ms        -10 %
  Route + global filter       20 ms       +100 %
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment