apple_pie icon indicating copy to clipboard operation
apple_pie copied to clipboard

router performance

Open petar-dambovaliev opened this issue 2 years ago • 2 comments

Hey there, i am a zig newbie here. It looks to me that the router is splitting the called url path by slash and matching on those substrings. The trie is the correct data structure for this but it will be much more efficient to match on characters or bytes.

https://github.com/darpi-rs/darpi/blob/master/gonzales/src/lib.rs

If you think its worthwhile to improve this, you can checkout my router implementation in my rust web framework. It also has case insensitive capability without runtime costs.

petar-dambovaliev avatar Aug 26 '21 17:08 petar-dambovaliev

Yep, it's a quickly implemented version just to get it working. As the sever has 0 dependencies on it, people can just implement their own version. For that reason it's simply not high on my priority list for now, there's more to implement first as routing isn't even part of the spec. I do have one other implementation that I someday will adapt and increase its performance of, but that's not going to be soon: https://github.com/Luukdegram/ctradix

Luukdegram avatar Aug 26 '21 19:08 Luukdegram

Yep, it's a quickly implemented version just to get it working. As the sever has 0 dependencies on it, people can just implement their own version. For that reason it's simply not high on my priority list for now, there's more to implement first as routing isn't even part of the spec. I do have one other implementation that I someday will adapt and increase its performance of, but that's not going to be soon: https://github.com/Luukdegram/ctradix

Yea, that is very similar to what i have. I am trying to get into zig and thinking about whether it's metaprograming capabilities will be powerful enough to make these handler functions nicer. Meaning, having alternative to the Rust macro capabilities to be able to have framework provided object extractors from the request bytes and stuff like that.

petar-dambovaliev avatar Aug 27 '21 08:08 petar-dambovaliev