diff options
author | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2020-03-23 10:48:13 +0200 |
---|---|---|
committer | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2021-10-19 15:45:16 +0300 |
commit | 2249f3f81a82a0c04b91888afcb70bf5e6b25ff0 (patch) | |
tree | c6bf18a034c5dd739718ed6cc00a58ab89ae89ca /demux | |
parent | 4703b74e6c04e8e0760ad366ac0ee39576d9ff88 (diff) | |
download | mpv-2249f3f81a82a0c04b91888afcb70bf5e6b25ff0.tar.bz2 mpv-2249f3f81a82a0c04b91888afcb70bf5e6b25ff0.tar.xz |
lua: autofree infrastructure: x2 faster
The speedup is due to moving big part of the autofree runtime overhead
(new lua c closure) to happen once on init at af_pushcclosure, instead
of on every call. This also allows supporting upvalues trivially, even
if mpv doesn't use it currently, and is more consistent with lua APIs.
While x2 infrastructure speedup is meaningful - and similar between
lua 5.1/5.2/jit, in practice it's a much smaller improvement because
the autofree overhead is typically small compared to the "real" work
(the actual functionality, and talloc+free which is needed anyway).
So with this commit, fast functions improve more in percentage.
E.g. utils.parse_json("0") is relatively fast and is now about 25%
faster, while a slower call like mp.command_native("ignore") is now
about 10% faster than before. If we had mp.noop() which does nothing
(but still "needs" alloc/free) - it would now be about 50% faster.
Overall, it's a mild performance improvements, the API is now more
consistent with lua, and without increasing code size or complexity.
Diffstat (limited to 'demux')
0 files changed, 0 insertions, 0 deletions