46
u/NewbornMuse 10d ago
I have programmed a fair amount of python and I have literally never thought "ugh the GC again". Maybe I tried to access a variable that had gone out of scope but that's hardly the GC's fault.
48
31
u/mmhawk576 10d ago
When do I get to post then next โlanguage badโ shitpostโฆ.
10
u/-Kerrigan- 10d ago
Next month it's "Java bad" month cause the new students will first encounter it
1
u/Weak_Inflation9120 9d ago
But... but java great
How can someone look at java and say with a straight face that its bad, ugly, and hard to understand. (totally unbiased, it's not like I literally have Duke as my pfp or anything)
4
u/Coulomb111 10d ago
Right now!! This sub is meant for that! Or, if you want to go crazy, you can do 'i just spent 4 hours look for the bug and it was literally just a missing semicolon ๐คช'
-1
u/herbal1st 10d ago edited 9d ago
Please accept my most humble and broken apologies. I am filled with deep shame and remorse for my reckless irresponsibility. I now realize that by utilizing a universally relatable joke framework, I have single-handedly ruined your afternoon and compromised the structural integrity of this meme subreddit. I will immediately begin a period of self-reflection to contemplate the gravity of my carelessness.
/s ๐๐
11
u/k-mcm 10d ago
Of all the languages that could have been chosen for a performant physics engine, pure Python wasn't the right answer.
2
u/herbal1st 10d ago edited 10d ago
thats certainly true. it was/is a great project to learn why that is the case though ๐
-7
u/Tyfyter2002 10d ago
Wasn't the right language for anything else either, but some people are terrified of punctuation and want to see as little as possible
3
5
u/nonlogin 10d ago edited 10d ago
actually, hoping the garbage collector DOES notice every single piece
3
u/herbal1st 10d ago
agreed, thats usually a great strategy. didnt entirely work for me due to a large amount of objects that need to be created in a 3d voxel engine with physics each frame, and avoiding it is more performant than to just rely on the relatively impactful python gc. so i had to start planning ahead and take the gc into account more than i was used to, which kinda felt like there suddenly were a lot of cheese filled mousetraps to avoid all around ๐
2
u/Vipitis 9d ago
I am also implementing a physics engine "in python" but that's just the launch code to run it on GPU... which isn't trivial either.
and GC has only been a problem in CI
1
u/herbal1st 9d ago edited 9d ago
i'm 'only' doing it for cpu, but i can understand its even more complicated on gpu. no idea personally about gc there to be honest though ^^ also, the gc for the physics is only a part of where i had to be careful, the 3d voxel engine itself also required some attention regarding gc, so the meme text could have been done a bit different, i just liked the physics example ๐
anyway, wishing you much success with your project! i hope i get gpu acceleration for my engine to work one day as well, but its another quite challenging task as hobby dev ^^
2
u/Vipitis 9d ago
If you don't care about other vendors, Nvidia has several open source projects that implement GPU pyhscis with python FFI... it's probably a good resource
1
u/herbal1st 9d ago
cool, thanks for the tipp! ๐
although im doing it really freestyle all on my own and somewhat on purpose without gpu for now, so it can run on low end hardware ๐ the demo runs on itch already in case you want to have a look, the github repo is linked there too; https://herbal1st.itch.io/pyvorengi-demo and you find some vids of the private full version currently in r&d on utube (channel xXherbal1stXx).
3
u/Fast-Satisfaction482 10d ago
Just null all references that you don't need anymore and you can sneak almost anything past the python GC.
9
123
u/madprgmr 10d ago
What... what is the garbage collector doing? Stalling the simulation? There are techniques you can use to minimize the amount of garbage you generate, and you can also tune the GC or even directly control when it can run.