mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2026-10-24 00:49:00 +03:00
If we are using libffi to trampoline then there is opportunity to cache the ffi_call_plan introduced in newer libffi releases. A rather contrived test introduced in the previous commit includes a basic performance test that can compare between versions. For my system, the average call time dropped from 200ns/call to 145ns/call for cached GClosure. Since the previous version did no caching, the uncached GClosure use was also just slightly slower around 205ns/call. For the cached form (since it can reuse a global plan cache via GMutex) it drops to 180ns/call. So that is 27.5% savings and a 10% savings in runtime duration. Closes: #4002 Co-authored-by: Philip Withnall <pwithnall@gnome.org>