fa icon indicating copy to clipboard operation
fa copied to clipboard

Revamp benchmarking

Open Hdt80bro opened this issue 3 years ago • 9 comments

Adds benchmarking to the profiler and debug classes for functions.

Fixes https://github.com/FAForever/fa/issues/3730

Hdt80bro avatar Aug 02 '22 07:08 Hdt80bro

I'm completely open to UI or stats changes by the way. I'm pretty happy with how the bytecode displays (although it requires a lot of work to parse--we're one step away from our own Lua virtual machine at this point), but that's open to feedback too (e.g. if you have a different way to represent jumped-to instructions than just prefixing them with '>').

Hdt80bro avatar Aug 02 '22 10:08 Hdt80bro

I don't know what half of the statistics that you included means in practice. I'll have to look that up 😄 ! I don't have any initial feedback on the work done, we may need to tweak some benchmarks to not last a second (have a smaller number of iterations).

Garanas avatar Aug 03 '22 05:08 Garanas

Absolutely great work 👍 , I hope this changes our perception as to what is and is not a performance improvement. In particular, using upvalues to cache a table access has not shown to be as effective in practice. Running those benchmarks now reveals that too in some cases.

Garanas avatar Aug 03 '22 06:08 Garanas

I already set a metadata system for the benchmarks (e.g. for display like this), so it'd be a simple thing to add an iteration count to it if we need certain benchmarks to use fewer iterations.

Hdt80bro avatar Aug 03 '22 06:08 Hdt80bro

As for the statistics... it's looking like we might need to reevaluate what information is actually useful (e.g. Excess Kurtosis [how much more "tailedness" the data has compared to the normal distribution] is always about -1.5). I rewrote the statistics file more as a library that we could reuse elsewhere, so we shouldn't feel bad about not using everything it has to offer.

Hdt80bro avatar Aug 03 '22 06:08 Hdt80bro

There we go--I synced benchmark progress (though now it's a little slower) and implemented tooltips and custom benchmark runs

Hdt80bro avatar Aug 04 '22 12:08 Hdt80bro

WARNING: Error running OnMouseoverItem script in CScriptObject at 1b4a0c00: ...\jip\documents\delete-me\fa\lua\ui\game\profiler.lua(927): attempt to call method `AddressToString' (a nil value)
         stack traceback:
         	...\jip\documents\delete-me\fa\lua\ui\game\profiler.lua(927): in function `BytecodeTooltip'
         	...\jip\documents\delete-me\fa\lua\ui\game\profiler.lua(677): in function <...\jip\documents\delete-me\fa\lua\ui\game\profiler.lua:674>

It appears to be related to a tooltip, in particular this line causes it:

image

These return invalid results:

image

It appears to load the file in the UI, causing this particular up value to fail:

image

We can change the benchmark.

Garanas avatar Aug 05 '22 15:08 Garanas

@Hdt80bro do you have the intention to finish this pull request? If not, then you can close it

Garanas avatar Apr 12 '23 19:04 Garanas

I do.

Hdt80bro avatar Apr 16 '23 06:04 Hdt80bro