I have high hopes for this URL router to be a fast, independent
url router for various golang based web services. As I explained before, I have
been struggling with a performant non-framework orient URL router that takes plain
http.HandlerFunc definitions. Below is a toy example application showing what
Vestigo can do:
I have been inspired lately by the Echo project, who are creating
a small, unfancy golang based webframework with an awesomely fast router. I have
been contributing ideas to them this past week, namely this discussion.
and I truely admire how quick of a router implementation they have been able to
That being said, I still had an itch that needed scratching. Within Echo, Gin,
HttpRouter, there is one thing that really bugs me still… non-standard handler
function signatures, and the requirement of using their context concept.
I decided last night to create vestigo to scratch that itch, and
after a night of work, I feel like the results speak for themselves. I took
a lot of ideas and routing implemenation from the echo router, and
added concept of storing URL matched parameters on the http.Request in the URL
RawQuery, much like the pat router does, instead of forcing implementers to
use a context object, or using a global map as some other routers do.
Below is an ordered list of various other URL routers tested, the amount of time
per routing operation, and the number of bytes and allocations of memory for each
operation. As Vestigo isn’t the fastest, it is holding it’s own
with the other routers out there, coming in fourth, and it is the first fastest
completely independent low overhead router.
I do have a few ideas for getting the number of allocations and amount of memory
per operation down even lower, that I am currently exploring. Though this router
isn’t the fastest, it is respectable, moreover it allows the flexibility to move
onto another router more easily than the other framework based routers out there.
I have a few items that I would like to see this router accomplish, enumerated:
Support for RFC 6570 - URL Templates
Optional Regular Expression Matching
Please let me know what you think, and yes, I love to collaborate with people,
feel free to open issues/prs!