-
Notifications
You must be signed in to change notification settings - Fork 22
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
Reduce CPU load #21
Comments
Thanks for the interest in the project! I have not done any CPU usage test in a while but last it showed to be take up 1-5% on a 200 character wide terminal. I have seem to miss placed the document on what I was using to test with due to that was over a year ago and a few machines. Regardless I do see your point and this would probably nice change. |
Very flat CPU stats - click to expand!
|
I was curious so I profiled the |
I see you were already on the right track here, |
yeah I have been meaning to work on the IO part more. |
I would have to do more research to be sure but if I remember correctly when |
Yes:
|
Potentially relevant: this. |
Would you consider using a different crate for outputting to the screen? |
I don't believe termion is cross platform but even if it is I do not want to swap out crates there are other ways of getting performance out of Rather than printing each character which can be a lot if your using the shading flag. Printing each row or Printing the hole screen at once could improve performance. |
I will work on reducing RNG calls as well even though its probably not a massive contributor to the performance issue but ever little bit helps. |
A very generic ~ » tput cols
213
-------------------
~ » tput lines
57 I guess the behavior is more pronounced in my case because the CPU is older. |
Yeah windows and mac native terminals do not do well esc codes, but using the alacritty terminal helps a lot with this.
Yeah that make sense, I'm sure this will help. Some time today I should be done with a basic implementation of it but not all flags will work. It will give a good indication if printing the hole screen helps. (If it doesn't I will be shocked) |
Sorry for the delay. Work has taken over this week. I will have something up on Saturday or soon if I get the time. |
So I have been working on the new draw improvements. This has turned out to be a usual a bit more complicated then I originally thought. Formatting the screen for characters that wider then a single space can throw a wrench in things. LOL One odd bug I manage to make was when adding color to the rain I get a weird solid character row flashing at the top. Just uncomment out the Some here if you want to take a look. Just keep in mind this is highly unfinished work. |
Yeah pretty much no flags work yet. |
Hi @cowboy8625, anything I can do to help here? |
No sorry man its been a crazy couple months. Just got married and other life things have been taking all my free time. Ill work on it this weekend for sure. |
Wow, congratulations! I wish you all the best. 👍 |
Thanks! |
Body and head colors work now. Some small bugs still to address but slowly getting there when I have time. |
Hi,
Awesome stuff here!
Did you consider an option for reducing the CPU load?
I experimented a bit with removing the
rng
calls and noticed performance improvements.How about creating a vector of possible values (everything which is currently random) and looping through it?
The user doesn't really care if a parameter is really random or not, they won't notice. They do care about CPU consumption, however. 😅
Here's what I've tried, let me know if you can reproduce:
The text was updated successfully, but these errors were encountered: