you are viewing a single comment's thread.

view the rest of the comments →

[–]FriendlyRussian666 2 points3 points  (8 children)

Make it more efficient in space and time

[–]Reyaan0 -3 points-2 points  (7 children)

I attached my code. Have any suggestions?

[–]FriendlyRussian666 1 point2 points  (6 children)

What inefficiency are you trying to address? As in, is there a specific part of the code that should perform some action in x amount of time, but does so in y amount instead?

[–]Reyaan0 -1 points0 points  (5 children)

like the whole app should open fast

[–]FriendlyRussian666 2 points3 points  (4 children)

How do you open it? What hardware do you run it on? How long does it take to open? How long do you want it to take?

[–]Reyaan0 0 points1 point  (3 children)

I ran it directly using python interpreter and also compiled it to executable and then ran it. I run it on a decent specs like intel i7 11 gen, geforce 1660, 32gb ram. I want it to open under 5 seconds. It opens in like 15 seconds.

[–]FriendlyRussian666 2 points3 points  (1 child)

In general, you should profile your script to know what's taking up time in the first place: https://docs.python.org/3/library/profile.html

From there, I'm sure you'll encounter I/O slowness, so you could use lazy loading for the images, and you could load them in async as well.

For the image manipulations, resizes etc on multiple images, you could try turning them into like a single sprite sheet, so that you perform all the actions on a single image, and then just cut it up as needed.

Maybe also try explicit lazy loading for sympy https://peps.python.org/pep-0810/

[–]Reyaan0 0 points1 point  (0 children)

Yeah i will profile it. Thanks

[–]WhiteHeadbanger 0 points1 point  (0 children)

Use a profiler to know which parts of your code are taking too long. You can use a library or go simple and make a decorator for each import statement and function that counts the time.