Skip to content

Profile startup and cut CI test run time in half

Jonas Ådahl requested to merge jadahl/mutter:wip/profile-earlier into main

Move MetaProfiler to MetaContext and tweak it a bit so that one can profile more or less from the first thing in main(): meta_context_init(), until the last: meta_context_finalize().

Sprinkeling COGL_TRACE_*() showed some interesting details:

  • meta_context_setup() takes around 45 ms when running the headless backend here. Some larger offenders are:
    • 6 ms - libwacom_database_new() - this could potentially be done in the input thread
    • 20 ms - gbm_device_create()
    • 4 ms - creating xkb keymaps (two identical ones that will be discarded a bit later)
  • meta_context_start() took 20-50 ms
    • between 10 ms and 40 ms was spent just getting the o.f.locale1 proxy. A patch is included to fix this.
    • half of the rest of the time was spent creating two identical keymaps, i.e. another 4 ms.

The whole point of this tiny adventure was to cut the time running the tests in CI. Here are some numbers (sample size 1 each, so take with a pile of salt):

architecture main this branch
x86_64 ~14.5 minutes ~6.5 minutes
aarch64 ~15.5 minutes ~8.5 minutes

This was achieved by avoiding spawning meta-dbus-runner.py and all its mocked D-Bus services for each test, but instead run all tests in a single meta-dbus-runner.py. This has some caveats: tests must make sure to reset any potential unclean state prior to running. This should already happen (see org.freedesktop.DBus.Mock.Reset that tends to be used) though, so maybe not that big of a deal.

Edited by Jonas Ådahl

Merge request reports