so a while ago i made a smol library for web servers without hyper and posted it here, but since then a lot of changes have been made (including new features and reaching 1.0.0)
repo: https://github.com/Brian3647/snowboard
any feedback / stars / recommendation would be appreciated since it's the first time i build an actually useful library for rust 
#[update] snowboard π: simple library for fast HTTP[s] servers
71 messages Β· Page 1 of 1 (latest)
Cool π project but I would like to know like how does it compare with something like axum and actix ? Like what are the advantages? And why should I use snowboard over it? Also, some benchmarks would also be cool. π
ive not published them but at least from what ive tested snowboard is ~50Β΅s slower/request in my machine with async on
it is simpler imo which is something i like
and avoids too much layers of abstraction like hyper
50Β΅s is an absurdly small amount of time
But I believe hyper is also not being used by actix. But still it is fast. So would love to know like what makes it a better choice over actix? π
Maybe it was Axum? Idk I forgot
Wether is a better choice or not is subjective
Also I love simplicity as well but are there any other like strong reason like you would suggest which might not be there in other projects or something that makes it truely unique to your project like for example a strong focus on security, any other thing strong reason ? Would love to hear π
Actix offers easier body & query parsing whereas snowboard offers less abstraction for more freedom of use
Not saying you can't do things on actix but it's clearly designed to be way more easy to use
Snowboard is simplicity
Also, I think snowboard can be faster than actix with some changes
Currently it's using std::net::TcpStream but I think that if I switch to a non-blocking alternative like async_stds the performance would be way better
Also the request parsing could be slightly faster, even tho it's already extremely fast
Ok I see, maybe I think now I have a suggestion maybe you could make the project very small and support something like a plugin system like seperate crates for implementing serialization and stuff. Also, ratelimiting can be a seperate crate, etc. What do you think? π .
So basically your project would be like the core which you can call it snowboard-core then there could crates like snowboard-serde, snowboard-rate-limit, etc. That's my idea. What do you think?
Something I do like about snowboard is that I made ResponseLike, which is an extremely useful trait. For example:
async fn handler(request: Request) -> Result<Response, Response> {
let example = middleware(request)?; // automatically returns on failure
...
}
fn middleware(req: Request) -> Result<(), Response> {
if request.method == Method::DELETE {
return Err(response!(method_not_allowed));
}
Ok(())
}
I've been testing and the use of Result<Response, Response> implementing ResponseLike makes middleware 0-config
Rust has a p good way to handle ? so it works wonders
Maybe if this could be seperated which I am not sure if it is possible then that would also be cool like the main project would become a little bit more smaller. Also, people would also be able to implement their own middleware stuff which could make it lot more customizable too. π . Just a suggestion.
It does actually
You can freely implement ResponseLike for anything you want
In the readme iirc I wrote an example
I'm on mobile rn so I'm just guessing links lol I hope that one works
No no I saw the readme I think you didn't get my point I was suggesting maybe we can't decouple the code for ResponseLike trait from the main project into a seperate crate altogather. π
why? The project isn't even that big
and responselike is literally a single-file thing
I think it will give more freedom to the user like they can implement their own 'ResponseLike` trait from scratch which can also allow for more diverse implementation to also exists as well. What do you think?
In terms of maintainability this will reduce the lines of code from the main project which can also prove beneficial for maintaining the project too.
The issue with that is that if every single implementation of responselike is in a library it will have 2 problems:
- That library will have 18272728282 dependencies and it will probably become a feature mess
- People will still find things that aren't implemented
For niche specific cases I think it's just best to let the user implement it themselves
For example, markup implements different "ResponseLikes" of other libraries and that other libraries don't necessarily include markup
that's the code for responselike
Ok thanks for the explainations I think for this part I can work on a tokio based implementation if you are interested to have it. π
I don't want to depend on Tokio i'd rather use async_std but yeah we can take a look at it
Tho that would mean removing the async feature since async will have to be used anyways
Please open an issue and we'll put some important info there if you want to
Yes sure would be glad to help π I will do so soon.
btw, instead of Tokio if speed is the only thing that matters I think may might be even faster, idk tho benchmarking needs to be dlne
I think this thread is getting too and off-topic so instead I have Dm-ed I hope it is fine for you? π
if your putting "really fast" in the name, it shouldnt be slow
how much do you think 50Β΅s is lmao
its 0.00005 seconds
rather slow in my opinion
your 50ΞΌs slower
i could be spending those microseconds being useful
How are you benchmarking?
Why?
Bad wording, I meant to say it already uses async_std with the async feature and I already have worked with it so I don't want to change everything
I know this isn't proper benchmarking but I'm just testing on my machine (iirc I used vegeta for this https://github.com/tsenart/vegeta)
I'll do proper benchmarking, I also want to properly test request parsing times for requests and urls
If this gets a bit bigger I might consider adding it to techempower's benchmarks to compare it properly
Note that I forgot to say before: the benchmarks are with the async feature on, with it off it's way slower
it is really fast, he didn't say 'the fastest'.
https://github.com/Brian3647/snowboard/issues/10 if anyone wants to help to improve perf 
I see myself using it, it quite has node http server vibe π
cool, any feedback is appreciated
care to make a post on reddit? π that way you will get more attention.
i already did on r/opensource r/coolgithubprojects and r/rust (this one a month ago) but if you find a way to promote it without making it look like you're my secondary account sure, go ahead
i got a p big issue lol
https://github.com/Brian3647/snowboard/issues/10#issuecomment-1871425125
btw ty for the stars 
[update] snowboard π: simple library for fast HTTP[s] servers
After giving up on this 2 years ago, i've managed to solve the underlying issue that kept me from progressing (blocking io) thanks to smol and async closures :3
It's been fixed with update 0.8.0
i'll be working some more on this