Skip to content
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

Optimize startup #12

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

otzen
Copy link

@otzen otzen commented Dec 5, 2021

The reason I forked this project in the first place was because I wanted to exercise a bit in speed-optimizing python code.

First i added some code to display the consumed time along with the "initializing .....:complete" messages.

Then I Found two places where the initialization could be quite a bit faster. Both related to the planet initialization.

Before:
Initialising Planets: : complete. in 20.547 seconds.
After:
Initialising Planets: : complete. in 3.737 seconds.

If you like this change please take it and use it, if not just reject it. I had my fun and got to sharpen a skill ;-)

Martin Otzen and others added 4 commits December 5, 2021 03:05
There was a bug htat caused the process to hang, I narrowed it down to the pygame.init being called multiply tims.
@nuke Bloodaxe if you don't like the pyCharm ide just leave out the .idea folder in the pull request merge.

removing format changes
I did not want to maintain this as many many repeated lines, so I created a wrapper function for this.
Not sure the multiline format that I use is the prettiest, but did this to make any future diff/merge easier.
Before:
Initialising Planets: : complete. in 20.547 seconds.
After:
Initialising Planets: : complete. in 3.737 seconds.
@otzen
Copy link
Author

otzen commented Dec 5, 2021

Hmm some of the old formatting stuff sneaked in here, I will update shortly.
This also builds on top of #10 so merge is easier if you take that first.

There is a few blank lines with spaces, that my editor insist to remove.
Please use the
image
to ignore those.

Copy link
Owner

@nukebloodaxe nukebloodaxe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you break out the adjustments to planets.py into a separate request, I'll quite happily accept that one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants