Xonotic Forums
0.8.6 and git - Stutter points / Profiling / Code Optimization - Printable Version

+- Xonotic Forums (https://forums.xonotic.org)
+-- Forum: Creating & Contributing (https://forums.xonotic.org/forumdisplay.php?fid=10)
+--- Forum: Xonotic - Development (https://forums.xonotic.org/forumdisplay.php?fid=12)
+--- Thread: 0.8.6 and git - Stutter points / Profiling / Code Optimization (/showthread.php?tid=9874)



0.8.6 and git - Stutter points / Profiling / Code Optimization - dagelf - 06-08-2024

Hi All

Has anyone built ops around benchmarking the darkplaces or Xonotic codebase?

I stumbled on Optimizing my game so it runs on a potato where a Godot game dev details things he did to get his fps up from 15 to over 100 fps...

Was thinking that I should just plain profile the code, and maybe take a bash at it, maybe one of those tips (like randomizing the times at which bots do their path calculation - if its not done already) - maybe there's still some scope for improvement?

Does anyone have any tips / are there any existing profiling scripts or documentation, specifically aimed at programming?

I noticed that darkplaces has a "make profile" option, but that's as much as I could find, without diving into doing it myself... (nothing on any related issue trackers)

(I'm not talking compilation flags like here https://forums.xonotic.org/showthread.php?tid=3178)


RE: 0.8.6 and git - Stutter points / Profiling / Code Optimization - dagelf - 06-08-2024

Wow, that was too easy.

Code:
$ make profile
$ ./darkplaces-sdl -xonotic -basedir /usr/share/xonotic/
# proceed to play a packed server with some say annoying sound effects ;-) (Jeff & Julius Resurrection Server :P )
# that gets you gmon.out
$ gprof darkplaces-sdl gmon.out > gmon.txt
$ head -32 gmon.txt
  %  cumulative  self              self    total         
time  seconds  seconds    calls  s/call  s/call  name   
20.05    132.88  132.88  3168772    0.00    0.00  CLVM_ExecuteProgram
10.59    203.09    70.21 70352770    0.00    0.00  Mod_CollisionBIH_TraceLineShared
  6.13    243.75    40.66 698051575    0.00    0.00  CSQC_Think
  4.59    274.17    30.42  1029143    0.00    0.00  Mod_Skeletal_AnimateVertices_SSE
  3.23    295.59    21.42 50805973    0.00    0.00  RSurf_PrepareVerticesForBatch
  3.13    316.32    20.73  1068728    0.00    0.00  R_DrawModelDecals_FadeEntity
  2.54    333.16    16.84 54078747    0.00    0.00  Mod_CollisionBIH_TracePoint
  2.23    347.91    14.75  191770    0.00    0.00  R_DrawParticles
  1.91    360.56    12.65 392409904    0.00    0.00  Mod_Mesh_IndexForVertex
  1.79    372.41    11.86 701891127    0.00    0.00  PRVM_EnterFunction
  1.76    384.08    11.67  556380    0.00    0.00  R_DrawModelDecals_Entity
  1.43    393.53    9.45 77324176    0.00    0.00  R_GetCurrentTexture
  1.32    402.30    8.77 35884921    0.00    0.00  R_SetupShader_Surface
  1.29    410.85    8.55  367438    0.00    0.00  Con_DrawNotifyRect
  1.21    418.87    8.02  1561806    0.00    0.00  R_DrawParticle_TransparentCallback
  1.17    426.65    7.78 701893234    0.00    0.00  PRVM_LeaveFunction
  1.13    434.16    7.51 698050749    0.00    0.00  CSQC_Predraw
  1.09    441.39    7.23  7877702    0.00    0.00  R_DrawModelSurfaces
  1.03    448.21    6.82 88624154    0.00    0.00  Collision_TraceLineBrushFloat
  0.83    453.73    5.52 431065778    0.00    0.00  _R_CullBox
  0.73    458.60    4.87  2481035    0.00    0.00  CL_NewParticlesFromEffectinfo
  0.67    463.02    4.42  483579    0.00    0.00  R_Q1BSP_RecursiveGetLightInfo_BSP
  0.66    467.40    4.38  199499    0.00    0.00  R_View_WorldVisibility
  0.65    471.73    4.33  191772    0.00    0.00  R_MeshQueue_RenderTransparent
  0.65    476.05    4.32  7668008    0.00    0.00  Mod_CollisionBIH_TraceBrush
  0.64    480.32    4.28 105853490    0.00    0.00  R_Mesh_TexBind
  0.63    484.50    4.18  192314    0.00    0.00  MVM_ExecuteProgram
  0.62    488.62    4.12  198828    0.00    0.00  CL_UpdateWorld
  0.52    492.10    3.48 171533803    0.00    0.00  Font_GetKerningForMap
  0.52    495.54    3.44 10835766    0.00    0.00  DrawQ_String_Scale

#https://github.com/dagelf/darkplaces/blob/profiling-tests/gmon.txt