player/lua/defaults: add LuaJIT profiling support#17785
player/lua/defaults: add LuaJIT profiling support#17785N-R-K wants to merge 1 commit intompv-player:masterfrom
Conversation
66167cb to
48d0617
Compare
|
Pretty rudimentary right now. Just dumps to a file/stdout. Maybe makes sense to display it in somewhere in the stat page? Open to suggestion on how the interface should be like. |
I think we could just print it into the log.
I think it's too much info to fit info stat page. Technically with some preprocessing we could show some info. Similar to |
e0e4a7c to
7090de5
Compare
gives us a way to properly profile the lua scripts to get some verifiable way to test which "optimizations" work and which don't. currently only supports LuaJIT but the cli option is generically named in case support for profiling other scripts is added in the future.
7090de5 to
5718675
Compare
It's just standard lua io, what's NIH here?
Very common case is to have a base profile and then make change and collect another profile. Yes, you can just grep the log and extract it manually, but if we're going to add a cli option it should at least make the common cases easy to handle. Otherwise, you can also argue "KISS, just let users do their own luajit markup themselves". |
I agree with you. If the main feature of this integration is saving to external text file, than indeed it's best to not include it in the mpv core. |
Interesting. The ~8 loc saving the profiling report to a file is the main feature and not the other ~100 loc to collect and format the profiling information?
Almost entirety of the added code lives in |
Out of the 106 added lines in default.lua, 44 are only related to saving the profiling report to a file. Don't be disingenuous by saying it's ~8 loc. It's not about loc. I noticed that almost half of the PR is about saving file, and I suggested to keep it simple and log it through our existing log code, that can also save to file. It can be 1000 loc, if there is a value it that, you can draw graphs, flame graphs, whatever, I don't mind.
default.lua is very much mpv core, it's embedded and used for every script. |


gives us a way to properly profile the lua scripts to get some verifiable way to test which "optimizations" work and which don't.
currently only supports LuaJIT but the cli option is generically named in case support for profiling other scripts is added in the future.