Skip to content

gs-plugin-job-refine: Parallelize same order plugins

The GsPluginJobRefine job runs each plugin's refine asynchronously and in order. This works great, but there's a small optimization we can make: run plugins with the same order in parallel.

Let's say we have 5 plugins: A, B, C, D, and E. Imagine Software loaded them, and determined that their orders are, respectivelly, 0, 0, 1, 1, and 2. With the current refine job chain, plugins would run sequentially, as follows:

A → B → C → D → E

Which is technically correct, since it respects the plugin order. In theory, plugins of the same order don't conflict, so we could improve this by running A and B, and C and D, in parallel, like this:

(A, B)  →  (C, D)  →  E
   ^         ^        ^
 Order 0  Order 1   Order 2

This should still preserve the order that Software determined, and allows cutting some time.

Do just that.

According to Sysprof, this reduces refining times 100~250 ms, which is not much, but it's good to have nonetheless.

Merge request reports