Why rutt? #1059
Replies: 2 comments
-
Awesome comparison! I'm also curious about the intentions. Just adding some thoughts here. I like rutt. It might not be the fastest, but it's dead simple. When choosing a router that your fresh (🥁) new framework will rely on, it is reasonable to choose a one that you can understand at a glance. You might end up maintaining it yourself. Also, It would be interesting to see, how the router affects the overall response times of fresh. How much faster will fresh be with a 150x faster router? Is it worth the extra complexity? |
Beta Was this translation helpful? Give feedback.
-
There is nothing special about rutt. I'd like to eventually specify and implement a native In the mean time if you have a URLPattern compatible router that is provably correct (ie passes WPTs) that is significantly faster than rutt, I'm happy to switch to that 🙂 (All pending real world benchmarks - I think the bottleneck for most projects is preact, not routing) |
Beta Was this translation helpful? Give feedback.
-
Hi @lucacasonato !
I've been wondering what was the reasoning behind using
rutt
as a router for Fresh?Rutt is simply iterating over an array of routes (having O(n) time complexity) - which I know you know since you're trying to optimise routes by sorting them - while most routers use a Radix tree with time complexity O(log n).
There are many radix-tree based routers available for deno on deno.land/x and many more now available thanks to the npm support ready in deno 1.8.
I've benchmarked a couple of routers using https://github.com/delvedor/router-benchmark (rewritten to typescript & deno):
(tested under deno 1.28 on an m1 macbook pro 13" 16gb)
Maybe there's something about rutt that I just don't see and I wanted to understand the reasoning 😅
Beta Was this translation helpful? Give feedback.
All reactions