Closed dbanty closed 3 years ago
Also I think this is the only reason we use async, we don't do anything in parallel. And reqwest+octocrab+Tokio are > 25% of Dobby's size so that doesn't seem worth it.
So the real answer is probably to rewrite with blocking code and take out async altogether.
Some additional info pre-refactor:
cargo build --release
takes about 2 minutes to complete after a cargo clean
on my machine. Probably significantly longer on the average machine / internet connection.dobby
is 7.8MBHopefully those numbers go down considerably with the dependency simplification.
With switching out octocat/reqwest for ureq:
Seems like a pretty clear win. I think the GitHub code is actually a little cleaner now too, as previously it was fetching both issues and PRs and filtering client-side. Now we're fetching just Issues because we're using the new v4 API (I assume, based on the limitation, that Octocrab was using v3).
According to cargo bloat
the next biggest area we might get savings is from ditching regex
. We only use it right now to parse branch names so it should be easy enough to replace with std string functions. Looks like toml_edit
is pretty big too. We could replace that with standard toml
(which we also have and need), it'll just take more doing. I'll create separate issues to explore those things.
This dependency binds us to specific Tokio/Reqwest versions. I'd rather use async-std anyway, and we don't have that option. It also contains a ton of features we don't use.
The immediate solution would be to write our own requests for the few pieces of the GitHub API that we do use, although we need to weigh this against the possibility of adding more direct GitHub integrations.
We could also fork octocrab and make it compatible with async-std using a feature flag (if portability is the main concern).