#10767·lvgl

Certain widget operations suffer from quadratic time blowup

Author: Bryght-Labs-RichardCreated Sep 24, 2026Updated Sep 24, 2026

LVGL version

Found on v9.3.0-5-gc21e60997, appears present on v9.6.0-35-gd3c5b419a

Platform

Custom ESP32-S3 board

What happened?

Each time we set LV_LABEL_LONG_MODE_SCROLL or LV_LABEL_LONG_MODE_SCROLL_CIRCULAR on a new label, or create a spinner, it takes progressively longer to do so. This was from v9.3.0:

Image

This might not seem too bad, but can be quite a bottleneck when creating a number of labels and spinners on screen creation. One example might be a game with an opponent picker, with each opponent having a name label, strength label, hometown label, and a placeholder spinner while their image downloads.

For the case of lv_label_set_long_mode(), it seems to be caused by this timer-list walk:

    /*Delete the old animation (if exists)*/
    lv_anim_delete(obj, set_ofs_x_anim);
    lv_anim_delete(obj, set_ofs_y_anim);

For spinners, lv_spinner_constructor() -> lv_spinner_set_anim_params() -> lv_anim_start() -> remove_concurrent_anims()

Other widgets may also be impacted.

There are probably a few ways to fix it:

  1. Track lifetime of animations per-widget, then only attempt to delete animations that exist.
  2. Different timer data structure that groups timers by function pointer, or allows direct lookup and deletion

Kevin-BryghtLabs discovered this, I'm just documenting it and MCVE.

How to reproduce?

  static volatile bool debugger_breakout = true;
  for(unsigned i = 0; debugger_breakout; ++i){
    //Optional: boost RTOS priority across the next few lines, restore before printf
    uint64_t before = esp_timer_get_time();
    lv_label_set_long_mode(lv_label_create(lv_screen_active()), LV_LABEL_LONG_MODE_SCROLL_CIRCULAR);
    uint64_t after = esp_timer_get_time();
    printf("lv_label_set_long_mode(lv_label_create()) #%u took %uus\n", i, (unsigned)(after - before));
  }