Skip to content

clutter/actor: avoid transform node for identity matrix

Christian Hergert requested to merge wip/chergert/identity-matrix into master

If the transform matrix is an identity, then positioning wont change and we can avoid creating the transform node altogether. This is based on a similar find in GTK today while reducing temporary allocations.

This cuts the number of transforms created in clutter_actor_paint() by about half under light testing of GNOME Shell from 6.8% to 2.4% of allocations.

Before:

    ALLOCATED      TOTAL    FUNCTION
[   20.4 MiB] [  21.20%]    clutter_actor_paint
[   11.0 MiB] [  11.45%]      clutter_paint_node_paint
[    6.6 MiB] [   6.84%]      clutter_transform_node_new
[    2.5 MiB] [   2.61%]      clutter_actor_node_new

After:

    ALLOCATED      TOTAL    FUNCTION
[   33.4 MiB] [  24.12%]    clutter_actor_paint
[   26.2 MiB] [  18.91%]      clutter_paint_node_paint
[    3.4 MiB] [   2.43%]      clutter_actor_node_new
[    3.3 MiB] [   2.41%]      clutter_transform_node_new

Allocation amounts will have differed due to different amounts of running time, but the % of allocations has now dropped below clutter_actor_node_new() which should be expected.

#1056 (closed)

Edited by Christian Hergert

Merge request reports