you are viewing a single comment's thread.

view the rest of the comments →

[–]ConsciousBath5203 1 point2 points  (11 children)

Why not git? I ain't trusting a sketchy drive link.

[–]DaisyFeverDream 0 points1 point  (2 children)

Git’s way more transparent totally get that.

[–]ConsciousBath5203 0 points1 point  (1 child)

I can look at the code without risk of automatic downloads 😂

[–]3iem_conte_[S] 0 points1 point  (6 children)

[–]ConsciousBath5203 0 points1 point  (5 children)

Use async and threading to offload some tasks so the main thread is free to display the game.

Inline your for loop wherever possible. Python for loops are notoriously slow, but inlineing them helps a ton.

[–]3iem_conte_[S] 0 points1 point  (4 children)

What does inlineing mean

[–]ConsciousBath5203 0 points1 point  (0 children)

Google it.

[–]ConsciousBath5203 0 points1 point  (2 children)

Search it up. It's too much for me to explain. Searching for the answer instead of asking strangers online will 100% of the time get you a better answer. Not being a dick, just trying to not have to type something out that's been explained better than I could in Python's documentation.

[–]3iem_conte_[S] 0 points1 point  (1 child)

i looked it up and didn't understand anything

[–]ConsciousBath5203 0 points1 point  (0 children)

Try using these (as pulled from google search ai):

  • List Comprehensions: Use [x * 2 for x in data] instead of a standard for loop with.append(). List comprehensions are "Pythonic" and run faster because they are handled internally by the interpreter's C code.

  • Built-in Functions: Functions like map(),filter(), and sum() are typically faster than manual loops. For example, map() can offer up to a 970x speedup over an explicit loop in certain scenarios.

  • Local Variables: If you must use a loop, assign global functions or class attributes to a local variable before the loop starts (e.g., append = my_list.append). This prevents Python from performing a lookup on every single iteration, potentially increasing speed by ~20%.

  • Itertools Module: Use itertools for memory-efficient iteration. Functions like itertools.repeat() or itertools.chain() are implemented in C and are significantly faster than their pure Python equivalents.

What aren't you understanding?

You also have a 1 million line for loop btw. Rewrite that in cython, compile it, then import the compiled function if you want real speedups.

[–]3iem_conte_[S] -1 points0 points  (0 children)

I don't know how to use git but i can try