-
Notifications
You must be signed in to change notification settings - Fork 289
async get_info_lines #186
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
async get_info_lines #186
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 🙂 👍
Just left a few optional suggestions on code style.
Have you had a chance to compare the performance difference before and after this change?
I didn't see any noticeable differences when running the command on the Linux repo. Either on master branch or the feature branch I was getting a 35s response time on average |
🤔 I guess that the functions for gathering repo data were already fast enough that concurrency doesn't have a large effect. We may want to test exactly where the most slowdown is (my instinct is that it's somewhere around the language analysis). |
This part is certainly responsible for an important proportion of the response time. it's why in the parent issue, I chose to compare the performance of Onefetch with Tokei (responsible for the language stats). A 3x difference is quite significant. I am curious to see what are the other bottlenecks |
As am I 😄 But I guess further discussion about optimization belongs in other issues. Anyway, your changes in this PR look great! 👍 |
Looks like we made a bit of a mistake. See the behavior of this code. While all the I'll have to read more into the documentation of libraries that help with async, like |
Try this This blog post explains it. Coming from a C# background, I am kind of suprised/disappointed by this behavior... And looking at the telemetry I have done in the past:
It does seem to run synchronously. |
Yeah, looks like Rust's async/await behaves more like how Python behaves (I just had to switch over from a sync library to an async one yesterday for this same reason). So I think the best option is multi threading as you suggested. |
#185
The
get_info_lines
was the obvious first choice to start playing with theasync
paradigm.