@asterite Whoa thanks! It deff made quite a difference! Not only did speed improve, memory per operation also was halved, and in some cases ~6x less! URI.decode
must have also been a bottleneck in retour
as it jumped up quite a bit as well. Given amber
and radix
didn’t change much I’m going to assume they’re not using it, so technically they may have an issue with matching an encoded URL, which makes the results even that much more impressive I’d say.
Benchmark Results w/ Optimizations
/get
retour 2.52M (397.20ns) (± 1.42%) 672B/op 4.16× slower
amber 3.20M (312.10ns) (± 1.15%) 387B/op 3.27× slower
Athena::Routing 10.48M ( 95.46ns) (± 1.35%) 64.0B/op fastest
radix 6.63M (150.87ns) (± 1.15%) 144B/op 1.58× slower
/get/books/23/chapters
retour 2.01M (498.37ns) (± 2.49%) 736B/op 1.25× slower
amber 1.21M (827.03ns) (± 1.55%) 966B/op 2.08× slower
Athena::Routing 2.52M (397.42ns) (± 1.37%) 322B/op fastest
radix 1.58M (632.64ns) (± 1.80%) 481B/op 1.59× slower
/get/books/23/pages
retour 2.67M (375.00ns) (± 2.04%) 672B/op 2.82× slower
amber 1.86M (537.34ns) (± 5.27%) 595B/op 4.04× slower
Athena::Routing 7.52M (133.04ns) (± 3.99%) 64.0B/op fastest
radix 1.72M (582.15ns) (± 1.93%) 416B/op 4.38× slower
/get/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z
retour 2.30M (434.52ns) (± 2.14%) 672B/op 4.26× slower
amber 332.26k ( 3.01µs) (± 1.38%) 4.04kB/op 29.50× slower
Athena::Routing 9.80M (102.03ns) (± 4.70%) 64.0B/op fastest
radix 1.90M (525.10ns) (± 1.60%) 353B/op 5.15× slower
/get/var/2/3/4/5/6/7/8/9/0/1/2/3/4/5/6/7/8/9/0/1/2/3/4/5/6
retour 735.58k ( 1.36µs) (± 5.60%) 1.17kB/op fastest
amber 180.40k ( 5.54µs) (± 2.41%) 6.19kB/op 4.08× slower
Athena::Routing 421.41k ( 2.37µs) (± 5.22%) 2.29kB/op 1.75× slower
radix 308.44k ( 3.24µs) (± 2.67%) 2.86kB/op 2.38× slower
/get/foobarbizfoobarbizfoobarbizfoobarbizfoobarbizbat/3
retour 1.93M (517.31ns) (± 1.61%) 768B/op 1.23× slower
amber 1.29M (775.56ns) (± 4.63%) 864B/op 1.85× slower
Athena::Routing 2.38M (419.42ns) (± 1.53%) 368B/op fastest
radix 1.13M (886.71ns) (± 2.32%) 593B/op 2.11× slower
/post/products/23/reviews
retour 1.88M (531.94ns) (± 1.12%) 768B/op 1.31× slower
amber 1.18M (849.14ns) (± 1.78%) 1.04kB/op 2.09× slower
Athena::Routing 2.43M (411.63ns) (± 1.37%) 369B/op 1.01× slower
radix 2.46M (406.87ns) (± 3.62%) 450B/op fastest
/put/products/Winter-Windproof-Trapper-Hat/dp/B01J7DAMCQ
retour 1.53M (655.02ns) (± 2.76%) 832B/op 1.25× slower
amber 841.82k ( 1.19µs) (± 6.68%) 1.3kB/op 2.26× slower
Athena::Routing 1.90M (524.94ns) (± 4.57%) 432B/op fastest
/get/test/foo_99
retour 1.93M (518.98ns) (± 1.93%) 736B/op 1.24× slower
amber 1.32M (757.77ns) (± 2.23%) 822B/op 1.80× slower
Athena::Routing 2.38M (420.18ns) (± 2.78%) 338B/op fastest
/get/test/foo_bar
retour 2.83M (353.24ns) (± 1.90%) 672B/op 2.88× slower
amber 2.02M (495.22ns) (± 5.12%) 501B/op 4.04× slower
Athena::Routing 8.15M (122.67ns) (± 1.10%) 65.0B/op fastest