Skip to content

Change logic to improve performance #5

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

Closed
wants to merge 1 commit into from

Conversation

ardavank
Copy link

@ardavank ardavank commented May 3, 2020

Thanks for the great tool!
I was using this tool and I noticed that it works great for small unitypackages but it's extremely slow for larger ones.
I improved the performance and wanted to share so that everyone can benefit from it

Results comparison: (using: MacBook Pro - 2.4 GHz 8-Core Intel Core i9)

~ 7 MB unitypackage file:

Before: 6.31 seconds
After: 0.62 seconds

~ 5.52 GB unitypackage file:

Before: I left it running for more than 15 hours and it never finished, had to cancel
After: 71.8 seconds

Thanks for the great tool!
I was using this tool and I noticed that it works great for small unitypackages but it's extremely slow for larger ones.
I improved the performance and wanted to share so that everyone can benefit from it

Results comparison: (using: MacBook Pro - 2.4 GHz 8-Core Intel Core i9)

~ 7 MB unitypackage file:

Before: 6.31 seconds
After: 0.62 seconds

~ 5.52 GB unitypackage file:

Before: I left it running for more than 15 hours and it never finished, had to cancel
After: 71.8 seconds
@Cobertos
Copy link
Owner

Cobertos commented May 3, 2020

Hmm, I guess it has to dig through the tar's entry table every time it does a getmember() or extractfile() and with 4 hits per entry, that'll be a lot of searching, especially for a 5GB tar...

My only concern with this PR is that if something goes wrong, the temp stuff is not deleted. Itd be preferable if we could use Python's tempfile to handle cases where something fails.

# create a temporary directory using the context manager
>>> with tempfile.TemporaryDirectory() as tmpdirname:
...    print('created temporary directory', tmpdirname)
>>>
# directory and contents have been removed

@ardavank
Copy link
Author

ardavank commented May 4, 2020

I agree, my code might not be production ready, I just wanted to share this with you. feel free to modify and improve it.

@Cobertos
Copy link
Owner

Closing this, updates are in #6
Thanks for the report and the start on the code :3

@Cobertos Cobertos closed this May 17, 2020
@Cobertos Cobertos mentioned this pull request Oct 17, 2021
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.

2 participants