Page MenuHomePhabricator

Very poor performance of elm_genlist_item_prepend()
Open, NormalPublic

Description

elm_genlist_item_prepend() is 100 times slower than elm_genlist_item_append() to add a hundred or so entries to an empty genlist. Freezing and thawing the genlist helps a bit but only halves the CPU time; that leaves a slowdown of 50.

On my (slow) machine I get the following CPU time usages:

  • item_prepend + freeze/thaw : 2.10s
  • item_append + freeze/thaw : 46ms
  • item_prepend : 6.11s
  • item_append : 52ms

I've done some poor man profiling and it seems that there is a lot of work done and thrown away immediately and done again. This wouldn't be surprising for item_prepend() but it should be handled a bit better in any case. Currently this seems to exercise eo and evas object creation and destruction an awful lot. This might be interesting as a benchmark for these. Unfortunately I don't have a reproducer that is written in C.

On a possibly related note, I haven't seen much info on the item recycling that was introduced in 1.18 and I'm wondering a lot about it.

adrien created this task.Oct 2 2016, 12:32 PM
adrien added a comment.Oct 8 2016, 8:28 AM

I've just tried to use the reuse of genlist items that landed in 1.18.0 and it helps a lot. However that API is not documented at all and therefore close to unusable: I've managed to get it to do something but I have no idea how (e.g. I don't understand the reason to make it optional nor the use of the part attribute).

stefan_schmidt triaged this task as Normal priority.Feb 10 2017, 6:41 AM
zmike edited projects, added Restricted Project; removed efl.Jun 11 2018, 6:54 AM
q66 edited projects, added efl: widgets; removed Restricted Project.Jun 11 2018, 7:33 AM
zmike added subscribers: segfaultxavi, zmike.

@segfaultxavi I can work with you on the genlist reuse api docs at some point?

Of course. You explain me how the thing works and I write the docs?

zmike added a comment.Jan 16 2019, 6:23 AM

You called my bluff. I had to look at it again.

The reuse api caches the genlist item and gives you a cached item content back in the reusable callback. This is essentially only useful if all your items are identical, as the cached contents of the items are saved too.

And which API is this? I cannot see any "reuse" in elm_genlist.eo. Also, why do we care about legacy widgets? Is there an Unified equivalent?
Also, this sounds terribly similar to @cedric's new caching factory stuff.

zmike added a comment.Jan 16 2019, 8:02 AM

This is Elm_Genlist_Reusable_Content_Get_Cb. I don't know how much we care, I am just suggesting improvements to issues raised in the ticket.