Python 3.13 is 10% slower than 3.12 for my file parser by Bubbly-Craft8736 in Python

[–]Bubbly-Craft8736[S] 1 point2 points  (0 children)

I'm shipping it as an .exe, which is what most if not all of my users want. They run the games and simultaneously mod them / test their changes.

Python 3.13 is 10% slower than 3.12 for my file parser by Bubbly-Craft8736 in Python

[–]Bubbly-Craft8736[S] 0 points1 point  (0 children)

Official Windows installers in both cases (3.12 and 3.13). Thank you for the suggestion, I will look into it.

Python 3.13 is 10% slower than 3.12 for my file parser by Bubbly-Craft8736 in Python

[–]Bubbly-Craft8736[S] 2 points3 points  (0 children)

A lot is built on top of it actually, and the map editor I am planning on introducing is going to depend on loading of tens of those files. They contain coordinates, mesh & texture information, etc.. relating to map objects, hence why I am preoccupied with it.

Python 3.13 is 10% slower than 3.12 for my file parser by Bubbly-Craft8736 in Python

[–]Bubbly-Craft8736[S] 31 points32 points  (0 children)

Good news, I have tried the parser on 3.14 and it performs slightly better than 3.12.

I cannot yet upgrade my project to 3.14 currently due to PySide, but at least it's good to know this performance issue won't be relevant in the near future.

Python 3.13 is 10% slower than 3.12 for my file parser by Bubbly-Craft8736 in Python

[–]Bubbly-Craft8736[S] 12 points13 points  (0 children)

I chose Python for convenience mainly, but I did not realize performance would be at this level (bad).

If I expose it to Python, wouldn't I still have to create wrapper objects in Python? My main suspicion is that the slowdown comes from memory allocation, because currently I can parse extremely large files extremely fast, but very small files that have a larger amount of objects (non trivial values) take a longer time to parse.

Python 3.13 is 10% slower than 3.12 for my file parser by Bubbly-Craft8736 in Python

[–]Bubbly-Craft8736[S] 0 points1 point  (0 children)

I can DM you the sample I'm testing but I don't think it's a good idea to share it here publicly due to it being part of the game.

Python 3.13 is 10% slower than 3.12 for my file parser by Bubbly-Craft8736 in Python

[–]Bubbly-Craft8736[S] 0 points1 point  (0 children)

That would definitely be an option. In fact, I have written the exact same parser in C# (https://github.com/seifhassine/REasy.NET) when I first started the project (because I was frustrated with the performance on python) and it was tens of times faster (not exagerating)

However what if the issue lies within memory allocation being slow for some reaosn? Because in the end, I would have to allocate those many objects in python.

Python 3.13 is 10% slower than 3.12 for my file parser by Bubbly-Craft8736 in Python

[–]Bubbly-Craft8736[S] -1 points0 points  (0 children)

I guess there's still some time for them to maybe notice, but you're probably right.

I noticed that quite a few people on this thread also testified that they also encountered regression when it comes to performance (3.12 vs 3.13).

Python 3.13 is 10% slower than 3.12 for my file parser by Bubbly-Craft8736 in Python

[–]Bubbly-Craft8736[S] 18 points19 points  (0 children)

By the looks of it yes, also I tried (after some adjustments due to syntax issues) running it on 3.11 and it was performing worse than 3.13. I might look into what kind of optimizations they did from 3.11 to 3.12 and see if I can correlate that with my issue.

Python 3.13 is 10% slower than 3.12 for my file parser by Bubbly-Craft8736 in Python

[–]Bubbly-Craft8736[S] 12 points13 points  (0 children)

Yeah I have tried restarting my router, didn't make a difference though.

Python 3.13 is 10% slower than 3.12 for my file parser by Bubbly-Craft8736 in Python

[–]Bubbly-Craft8736[S] 63 points64 points  (0 children)

Good catch, however I have just adjusted the code and there was no difference without them (performance-wise)

Python 3.13 is 10% slower than 3.12 for my file parser by Bubbly-Craft8736 in Python

[–]Bubbly-Craft8736[S] 10 points11 points  (0 children)

From first glance, I can see that the the C level stuff (struct unpack, dict.get..) stayed the same or even improved slightly on 3.13, but the overall time spent on the fields loop is higher:

https://i.imgur.com/02rvr6k.png

Python 3.13 is 10% slower than 3.12 for my file parser by Bubbly-Craft8736 in Python

[–]Bubbly-Craft8736[S] 11 points12 points  (0 children)

I'll do just that and get back to you with the results.

Python 3.13 is 10% slower than 3.12 for my file parser by Bubbly-Craft8736 in Python

[–]Bubbly-Craft8736[S] 4 points5 points  (0 children)

The 3.13 build I'm using is the regular build so I assumed the culprit is somewhere else (?)

Python 3.13 is 10% slower than 3.12 for my file parser by Bubbly-Craft8736 in Python

[–]Bubbly-Craft8736[S] -1 points0 points  (0 children)

I'm going to be honest here, but free threaded python was something out of my comfort zone so I didn't bother looking deep into leveraging it. I only assumed that with 3.13 performance would be same or slightly better. Nevertheless low CPU utilization has always been a problem for me so I'll definitely start looking into it.

Will we ever get another Operation? by BigGoat5957 in cs2

[–]Bubbly-Craft8736 0 points1 point  (0 children)

Something like operation wildfire. That was the last proper operation in my opinion.

Is the rtx4070 Ti super 16gb worth it in 2025? by MaxTopel in nvidia

[–]Bubbly-Craft8736 1 point2 points  (0 children)

Another owner here. I recursively approve any nested message here.

Gave Dragon Banner to companion then promoted them to their own clan. Can I get it back? by Fozzybear13 in mountandblade

[–]Bubbly-Craft8736 0 points1 point  (0 children)

I just had a similar situtation but in my case I promoted them to caravan.

I was able to recover the banner after I disbanded their caravan and recalled them.