refactor network stack, optimize performance, and add graceful shutdown#25
refactor network stack, optimize performance, and add graceful shutdown#25SpikeHD merged 11 commits intoSpikeHD:mainfrom
Conversation
|
Nice! Do you mind splitting this into separate PRs though? It's much easier to review stuff in isolation that way. |
|
i tried my best splitting them into 8 commits that you could review individually, if that's no hassle. this PR didn't have much of a goal other than general optimizations so I didn't think of splitting it into multiple PRs (especially since most of the newer commits depend on the older ones). although let me know if you still need me to split them (cant do them very soon tho cuz i have exams) |
|
Oh actually yea that's good enough, ty, I only originally looked at the changes tab |
SpikeHD
left a comment
There was a problem hiding this comment.
LGTM! Just curious about the nix-related stuff
| @@ -0,0 +1,34 @@ | |||
| { | |||
There was a problem hiding this comment.
idk anything abt nix (nor do I use it), do I need to do any maintenance/keep flake.lock up-to-date or anything?
There was a problem hiding this comment.
this is just a dev env (users cant install with it (i can add that if you'd like)) but no it does not require any maintenance
There was a problem hiding this comment.
i can also remove it if you'd like
There was a problem hiding this comment.
ok perfect, its totally fine to keep i just dont know anything about nix 🤪
|
Idk if the clippy errors are related to your changes but if they are could you pls fix them? If not I'll get to them eventually ™️ |
|
yeah sorry they were from the last commit, fixed them. |
|
thanks! |
General:
added nix flake (dev env)
optimized release profile
updated dependencies
implemented graceful shutdown
CLI
replaced reqwest (blocking) with ureq (reqwest is "fake" blocking aka it creates a tokio thread in the background, ureq is light-weight and actual blocking)
lib
refactored
DetectableActivityto use Arc (preventing useless clones)optimized
aho-corasickpattern matchingreduced
Mutexlocksadded logic to detect stale sockets and prune them
removed
sysinfofrom linux buildsrefactors
ipc: improved unix socket handling for automatic cleanups
logging: used an atomic bool to prevent overhead (reading env var on every func call)
cleaned up useless allocations in url_params, simplified ipc packet
performance/conclusion
memory: went from idling 150MB to 60MB
binary size: went from 5.1mb to 3mb