openforis/sepal_ui

evaluate the performances of the lib

Opened this issue · 3 comments

this can be extended to the applications notebooks.

I'm curious to know if we can improve their performances (they seems drastically long to load).

A nice heuristic to keep in mind:

  • make it work ✔️
  • make it nice ✔️
  • make it fast 🎯

food for thought on testing both the lib loading and the notebooks:
running a notebook as a python script
the tuna profiling lib

@dfguerrerom I checked the lib and it takes 18s to load in tuna which is simply huuuuuuuge. To make you realize how long it is:

  • pandas takes 0.5s
  • vuetify takes 6s
  • ipywidgets takes 5s

there is clearly something wrong. I have 2 guesses:

  • traitlets is an expensive lib and creating javascript/python binding cost a lot, we should revieww more carefuly when we use one.
  • we have an abstraction debt that is over the roof as we completely override the ipyvuetify lib that is already taking a lot of time to load. I think we should only rely on pure vuetify widgets and use an accessor to add extra functionality. I'll make a PR to ipyvue to integrate an equivalent to get_children.

Yes, the loading time is extremely slow. I agree with the second point of your guesses, that would reduce an important step on our side, so thumbs up for that one.

I also found on the web that complex type hints are actually slowing down Python code unless you use the annotation package (https://stackoverflow.com/questions/61544854/from-future-import-annotations). We have a lot of them, we should start using it everywhere untli it becomes the default behavior (not even in 3.11).