-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Increasing performance for large .bsp
files
#80
Comments
We might be able to avoid fully parsing Again, I would like to defer costs as much as possible so users only pay for what they use. |
After e9cd7ea >>> import cProfile, pstats
>>> cProfile.run("; ".join(["import bsp_tool",
... "bsp = bsp_tool.load_bsp('.../ApexLegends/season3/3dec19/maps/mp_rr_desertlands_64k_x_64k.bsp')",
... "del bsp;", "s3we.prof")
>>> pstats.Stats("s3we.prof").sort_stats("cumulative").print_stats(20)
Tue May 9 14:51:47 2023 s3we.prof
5877186 function calls (5877138 primitive calls) in 3.456 seconds
Ordered by: cumulative time
List reduced from 271 to 20 due to restriction <20>
ncalls tottime percall cumtime percall filename:lineno(function)
2/1 0.000 0.000 3.456 3.456 {built-in method builtins.exec}
1 0.000 0.000 3.456 3.456 <string>:1(<module>)
1 0.000 0.000 3.456 3.456 bsp_tool\__init__.py:48(load_bsp)
1 0.000 0.000 2.759 2.759 bsp_tool\respawn.py:158(__init__)
1 0.000 0.000 2.759 2.759 bsp_tool\valve.py:23(__init__)
1 0.000 0.000 2.759 2.759 bsp_tool\base.py:26(__init__)
1 0.001 0.001 2.759 2.759 bsp_tool\respawn.py:163(_preload)
6 0.508 0.085 2.106 0.351 bsp_tool\branches\shared.py:68(from_bytes)
950037 0.348 0.000 1.023 0.000 Python310\lib\re.py:187(match)
68 0.654 0.010 0.654 0.010 {built-in method nt.stat}
2 0.000 0.000 0.644 0.322 Python310\lib\genericpath.py:16(exists)
1355876 0.390 0.000 0.564 0.000 Python310\lib\re.py:288(_compile)
128 0.000 0.000 0.510 0.004 bsp_tool\valve.py:26(_preload_lump)
405707 0.156 0.000 0.480 0.000 Python310\lib\re.py:197(search)
148 0.458 0.003 0.458 0.003 {method 'read' of '_io.BufferedReader' objects}
950037 0.279 0.000 0.279 0.000 {method 'match' of 're.Pattern' objects}
1 0.000 0.000 0.249 0.249 bsp_tool\lumps.py:354(__init__)
7 0.218 0.031 0.218 0.031 {built-in method io.open}
1357273 0.174 0.000 0.174 0.000 {built-in method builtins.isinstance}
405707 0.157 0.000 0.157 0.000 {method 'search' of 're.Pattern' objects}
<pstats.Stats object at 0x0000025E5712E8C0>
>>> quit() |
MegaTest duration reduced from 14hrs to 1hr Comparing the |
The sheer cost of interpretting some large
.bsp
lumps can massively hurt performance reading various.bsp
filesOne serious source of this is
SpecialLumpClasses
, specifically theValveBsp
/RespawnBsp
GAME_LUMP
Apex Legends Game Lumps can easily contain hundreds of thousands of static props
Deferring the load time cost of
SPRP
GameLumps would be incredibly easybsp_tool.lump.BspLump
could be used to defer reading & interpretting data within the lumpIt's not like we check every lump has 100% valid data anyway (only size checks, no NaN / invalid enum checks)
see #68 for points on why this should apply to reading from file, and not necessarily the creation of new lumps
also see #23 to understand current issues w/
BspLump
The text was updated successfully, but these errors were encountered: