Closed rsalesc closed 2 months ago
so just sending requests asynchronously fixes this i guess?
Edit: Oh, you already fixed it? I thought it was an issue. Good find!
Also, given that we are dealing with localhosts, the request timeout should be something like 500ms
or 1s
.
Thanks for the PR, even though I've never had a problem with the serial calls on Ubuntu it's been a while since I've tried it on Windows (and never on WSL). I've made some changes to your branch:
sendTask()
implementation. If await getHosts()
throws, the error should be catched in the same place it used to be catched (i.e. it should lead to MessageAction.SendTaskFailed
being sent to the content script). If a host.send()
call throws, the error should be ignored.I've verified that the sending still works on my Ubuntu system, can you please pull in my changes and check whether you still see similar performance gains on Windows?
The changes I made cover some of the comments made by @touhidurrr, the rest can be ignored:
Cool, thanks, the code looks super clean now, and yeah, I messed up the existing error handling.
Just tested on my side, and I can still se a significant speed-up (just tested with CF 945 and went from ~30s to 7s, which is super reasonable).
EDIT: adding more context, I figured there are a few threads complaining about network speed in WSL2, so that might be coming from it (host communicating with WSL2). Hope that gets fixed at some point on their side.
Sorry for the delay, I'll publish these changes in a new release later this weekend.
I noticed Competitive Companion is getting slower with time, and it's mainly due to the fact that:
By making these requests in parallel, we can get a ~8x speed-up in contest parsing.
Serial calls:
Parallel calls:
Will be happy to do any other changes deemed necessary to get this through, the speed up was really helpful for me.
EDIT:
It's worth mentioning that I'm using WSL, and I'm not sure the extension is particularly slow because of that. Since it seems the code is like this for a long time, maybe the impact isn't noticeable in most of the cases (well, I expected a few localhost calls to be super fast, even if serialized).
But anyways, I'm getting super slow parses in WSL and this solves that. Maybe other users will benefit from this as well.