-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do some profiling #59
Comments
I've found httpbeast calls fcntl(2) every time to set nonblocking, even if it uses accept4(2). |
I did some profiling, leaving some notes here: Lines 252 to 253 in 5202b4c
These lines are a bit expensive - we could probably forgo the buffer and Lines 432 to 443 in 5202b4c
The int to string conversions here are a little costly - using something like https://github.com/brentp/mosdepth/blob/master/int2str.nim and appending directly to the buffer would be faster. |
Thanks @ajusa!
Regarding this, would it makes sense for Nim proper to adopt it for all int to str conversions? That way we can optimise everyone's code :D |
Potentially, though I seem to recall Araq being against stdlib optimizations since they seem to inevitably break someone's code. Additionally, I'm suggesting a different proc signature - rather than the proc allocating the string (as $ does), you pass in a var string for it to append onto. I'll look into it further if I have time. |
Hm, for what it's worth: I think if that happens we can revert, I don't think we should be this defensive. |
It might come as a surprise to some but I haven't actually profiled httpbeast thus far. I am getting more curious whether there are some low hanging fruit there to optimise.
I'll probably do it eventually, but if someone is interested in having a crack at it, please share what you find :)
The text was updated successfully, but these errors were encountered: