Improve CSS rendering performance
I worked on CSS engine to improve rendering performance.
It turned out that CSS engine uses linked-lists which leads to
O(n^2) algorithm complexity.
Especially this becomes apparent when is rendering container with a lot of direct children, like
GtkFlowBox (Gnome Nautilus uses this container).
For example, for rendering 10 000 elements GTK spent more than 300 seconds. That is exact reason why Gnome Nautilus hanging on opening big folders.
By using trees, instead of linked lists we get
O(N * long N) algorithm complexity.
I could improve performance from 80 seconds to 0.012 seconds (in 6750 times faster). By using the same technique we could eliminate
gtk_css_node_propagate_pending_changes also (in graphics it is still dominated making overall performance only 3x times faster)
There is a working branch with improvements - https://github.com/likern/gtk-patched/tree/custom-flowbox