Regarding the speed of obj create problem generation

my lvgl version is 7.11
I am working on a project recently and I am optimizing the code,I find that obj create takes a lot of time,such as i’m run lv_obj_create spent 3ms ,is so slow.My system running clock is 96Mhz.
I am looking for the problem in lv_obj_create this function.I found that the code time was spent in:

if(copy == NULL) {
if(parent != NULL) lv_theme_apply(new_obj, LV_THEME_OBJ);
else lv_theme_apply(new_obj, LV_THEME_SCR);
}
else {
lv_style_list_copy(&new_obj->style_list, &copy->style_list);
}

If I comment it out, it will be faster.
Then I followed this function to find, but I did not find a practical solution.

so ,Where is the time-consuming code?

Hi,

Some ideas to speed it up:

  • Try LV_MEM_CUSTOM 1 in lv_conf.h
  • Be sure all LV_DEBUG_... defines are 0 in lv_conf.h

(In v8 it’s much faster.)

i change LV_DEBUG_… set 0,but has not effect on speed.
And LV_MEM_CUSTOM .you malloc and free code is well written.my system molloc and free is reference your code.so this should be fine.

I found _lv_obj_get_style_int use many recursive function,Is this one of the issues that affects its speed?

The standard malloc/free could be faster then LVGL’s implementation. (In v8 we use different allocator which is way faster the the one in v7)

I found _lv_obj_get_style_int use many recursive function,Is this one of the issues that affects its speed?

It was really a problem with v7 which is addressed in v8. :frowning:

Have you enabled compiler optimization? -O3 usually results in double speed.

thanks you reply, i will use v8 in new peoject. I will keep watching lvgl updates