Hmm hmm. Do I implement http-server, or do I go and fiddle with NSoE?
I think I'll do a "quick" http-server.
Hmm hmm. Do I implement http-server, or do I go and fiddle with NSoE?
I think I'll do a "quick" http-server.
Haha. "quick". Haha.
❯ curl http://localhost:42069/ -A GPTBot
Sub(
RwLock {
data: Response {
status: 200,
version: HTTP/1.1,
headers: {
"x-verdict": "garbage",
"x-verdict-message": "known-robot",
},
body: (),
},
},
)
So close.
No dyn, no Box. Once I manage to construct a proper response with a body, I'll have to benchmark it against iocaine3.
I want not only the handler to be faster, but the http impl too.
Ok, new problem! I need a "body" for the request & response types, but I need to make them generic, because reasons.
I have a whole lot of funny generics now.
Speaking of generics, I quite like the new SexDungeon trait:
pub trait SexDungeon<REQ: Top + TopRoleplay, RES: Bottom + BottomRoleplay>: Send + Sync {
...
}
Ooof. This body business will be rough.
Urghargh. I got something, but it's bloody expensive, the entire response gets cloned.
That still clocks in at ~169k req/sec (when the response is a dummy HTTP 200 without any additional headers, and without a body), but I don't like the clone.
I have an Arc<RwLock<http::Response<Bytes>>>, and I need to consume it, and turn that http::Response<Bytes> into http::Response<Body>.
Well...
Arc::into_inner(self.0).unwrap().into_inner().into_parts()
And then constructing a new Response from that made things worse.
Unfortunately, I can't work with axum::body::Body directly, because the damn thing's not Sync.
I has a sad. iocaine4 with a dummy output method benchmarks the same as iocaine3, even though the decision making itself is considerably faster.
Response cloning is a problem. Maybe I should try writing the http server directly with hyper.
Huh.
Trivial PoC with hyper nets me the same ~160-170k req/sec, and the number of dependencies is exactly the same (276).
I guess I'm sticking with axum then. Will have another round of performance tuning later on.
Besides: the noop performance doesn't matter. NSoE with iocaine3 is a lot slower than that, and the primary goal is to provider more than that, and be faster.
Mkay. I have matchers, I have response, I have a http-server.
NSoE time? Maybe?
Or implement the garbage generators first. Or the configuration. I kinda want to do configuration, because that makes it easier to experiment with it.
So, uhh, yeah. I'll merge the http-server tomorrow, and have a go at configuration.