Dropdown performance #8637

Closed
opened 2025-11-02 08:13:03 -06:00 by GiteaMirror · 15 comments
Owner

Originally created by @fnetX on GitHub (Mar 1, 2022).

Feature Description

Currently, all kinds of dropdowns in Gitea are very slow. In fact, this is the most annoying thing with Gitea for me. Yes, I use fairly old hardware with awful performance. Still, I think it is not normal that a dropdown takes up to five seconds to open.

The first time a dropdown is opened on a page, this takes quite a while. On normal pages about 5 seconds from click to action, on pages with many dropdowns even longer. Once a dropdown was opened, all the (including other) dropdowns behave smoothly on that page until it is reloaded.

IIRC this is due to the placement of the dropdown being determined in Javascript and probably touches upon the discussion to drop jQuery and rewrite frontend code. I just wanted to report this, so it is kept in mind.

Screenshots

No response

Originally created by @fnetX on GitHub (Mar 1, 2022). ### Feature Description Currently, all kinds of dropdowns in Gitea are very slow. In fact, this is the most annoying thing with Gitea for me. Yes, I use fairly old hardware with awful performance. Still, I think it is not normal that a dropdown takes up to five seconds to open. The first time a dropdown is opened on a page, this takes quite a while. On normal pages about 5 seconds from click to action, on pages with many dropdowns even longer. Once a dropdown was opened, all the (including other) dropdowns behave smoothly on that page until it is reloaded. IIRC this is due to the placement of the dropdown being determined in Javascript and probably touches upon the discussion to drop jQuery and rewrite frontend code. I just wanted to report this, so it is kept in mind. ### Screenshots _No response_
Author
Owner

@wxiaoguang commented on GitHub (Mar 1, 2022):

If there is no evidence, it's hard to say that dropping jQuery and rewriting the code can improve performance ...

Indeed there are a lot of dropdowns implemented in jQuery, could you do some test to see if they are all slow? (some pages are already very large, so maybe the test could be done with some simple pages)

And during the frontend discussion and refactoring, there are too many voices about "I don't like it" or "I guess it has problems" or "it has bugs (but actually caused by no-document-reading / wrong-usage and misunderstanding)", these voices may mislead to make incorrect decisions ......

ps: I am not against about rewriting frontend (actually, I did most frontend refactoring recently, see my PRs ...). I just have a feeling that we should get firm evidences, make feasible plans and work together.

@wxiaoguang commented on GitHub (Mar 1, 2022): If there is no evidence, it's hard to say that dropping jQuery and rewriting the code can improve performance ... Indeed there are a lot of dropdowns implemented in jQuery, could you do some test to see if they are all slow? (some pages are already very large, so maybe the test could be done with some simple pages) * https://select2.org/dropdown * https://jqueryui.com/selectmenu/ * https://getbootstrap.com/docs/5.0/components/dropdowns/ And during the frontend discussion and refactoring, there are too many voices about "I don't like it" or "I guess it has problems" or "it has bugs (but actually caused by no-document-reading / wrong-usage and misunderstanding)", these voices may mislead to make incorrect decisions ...... ps: I am not against about rewriting frontend (actually, I did most frontend refactoring recently, see my PRs ...). I just have a feeling that we should get firm evidences, make feasible plans and work together.
Author
Owner

@fnetX commented on GitHub (Mar 1, 2022):

In fact, trying the dropdowns on all three links you just shared, they are fast. Also, I never encountered slow dropdowns anywhere except in Gitea.

Maybe the issue is that opening one dropdown apparently tries to position all the dropdowns (because after opening dropdown A, dropdown B, C, ... are all fast, too - I suppose when clicking A, their positions are also calculated making the opening slow)?

IANAFED (I'm not a front-end developer), though xD

@fnetX commented on GitHub (Mar 1, 2022): In fact, trying the dropdowns on all three links you just shared, they are fast. Also, I never encountered slow dropdowns anywhere except in Gitea. Maybe the issue is that opening one dropdown apparently tries to position all the dropdowns (because after opening dropdown A, dropdown B, C, ... are all fast, too - I suppose when clicking A, their positions are also calculated making the opening slow)? IANAFED (I'm not a front-end developer), though xD
Author
Owner

@wxiaoguang commented on GitHub (Mar 1, 2022):

Maybe the issue is that opening one dropdown apparently tries to position all the dropdowns (because after opening dropdown A, dropdown B, C, ... are all fast, too - I suppose when clicking A, their positions are also calculated making the opening slow)?

That's strange .... Most dropdowns in Gitea uses Fomantic UI Dropdown https://fomantic-ui.com/modules/dropdown.html

Could you try these dropdowns from the Fomantic UI official demo site?

  • If the dropdowns in the Fomantic UI demo site are also laggy, then it's Fomantic UI's problem
  • If only Gitea's dropdowns are laggy .... it's Gitea's problem 😂
    • and there are different dropdowns in Gitea, are they all laggy for the first time, or only some special ones are laggy?
@wxiaoguang commented on GitHub (Mar 1, 2022): > Maybe the issue is that opening one dropdown apparently tries to position all the dropdowns (because after opening dropdown A, dropdown B, C, ... are all fast, too - I suppose when clicking A, their positions are also calculated making the opening slow)? That's strange .... Most dropdowns in Gitea uses Fomantic UI Dropdown https://fomantic-ui.com/modules/dropdown.html Could you try these dropdowns from the Fomantic UI official demo site? * If the dropdowns in the Fomantic UI demo site are also laggy, then it's Fomantic UI's problem * If only Gitea's dropdowns are laggy .... it's Gitea's problem 😂 * and there are different dropdowns in Gitea, are they all laggy for the first time, or only some special ones are laggy?
Author
Owner

@lunny commented on GitHub (Mar 1, 2022):

@fnetX Could you point out which dropdown is slow so that I can reproduce that? And also could you test it in https://try.gitea.io ?

@lunny commented on GitHub (Mar 1, 2022): @fnetX Could you point out which dropdown is slow so that I can reproduce that? And also could you test it in https://try.gitea.io ?
Author
Owner

@fnetX commented on GitHub (Mar 1, 2022):

while the whole fomantic website is rather slow, the dropdowns there work fast (= as I'd expect from a website)

As far as I can tell, this affects all Gitea dropdowns, from navbar to special filter and in-site forms ... I'll keep an eye open if some dropdowns are faster than others.

@fnetX commented on GitHub (Mar 1, 2022): while the whole fomantic website is rather slow, the dropdowns there work fast (= as I'd expect from a website) As far as I can tell, this affects all Gitea dropdowns, from navbar to special filter and in-site forms ... I'll keep an eye open if some dropdowns are faster than others.
Author
Owner

@fnetX commented on GitHub (Mar 1, 2022):

Sorry, I had the last comment in the box for several hours. I noticed this on my local dev instance of Gitea, but I'm not sure which branch I was on earlier today. It looks much faster with latest main and try.gitea.io, although the languages dropdown is still slow.

@fnetX commented on GitHub (Mar 1, 2022): Sorry, I had the last comment in the box for several hours. I noticed this on my local dev instance of Gitea, but I'm not sure which branch I was on earlier today. It looks much faster with latest main and try.gitea.io, although the languages dropdown is still slow.
Author
Owner

@wxiaoguang commented on GitHub (Mar 1, 2022):

Hmm, if the languages dropdown is slow (while official Fomantic UI is fast), it should be something wrong with Gitea's frontend, the language dropdown is staticly rendered.

Could you try the Chrome's performance panel to capture the performance records? It could give us enough information.

You can save the records and upload them to share.

image

@wxiaoguang commented on GitHub (Mar 1, 2022): Hmm, if the languages dropdown is slow (while official Fomantic UI is fast), it should be something wrong with Gitea's frontend, the language dropdown is staticly rendered. Could you try the Chrome's performance panel to capture the performance records? It could give us enough information. You can save the records and upload them to share. ![image](https://user-images.githubusercontent.com/2114189/156194906-ff0b8029-c7a5-45cb-8432-0c17323fc3ce.png)
Author
Owner

@wxiaoguang commented on GitHub (Mar 1, 2022):

And another possible reason is the SVG/font rendering is slow on your computer .... there are a lot of SVG images in Gitea's dropdowns, and there are different characters in the language menu. Just a guess. The performance records will give us answers.

@wxiaoguang commented on GitHub (Mar 1, 2022): And another possible reason is the SVG/font rendering is slow on your computer .... there are a lot of SVG images in Gitea's dropdowns, and there are different characters in the language menu. Just a guess. The performance records will give us answers.
Author
Owner

@fnetX commented on GitHub (Mar 1, 2022):

GitHub doesn't like the attachment, here it is: https://drop.infini.fr/r/7MUEnQ7peK#dOh5b/4ZxsaDEZQVFH5+2q/kdh1z3NB3KY7IL8Ck3p8=

Screenshot from 2022-03-01 16-22-05

(for 1.16 where this is better reproducible for me)


and for main on try.gitea.io (language dropdown)

Screenshot from 2022-03-01 16-25-41

https://drop.infini.fr/r/tHZYm6jhkK#5gDA5xbVVZbl/9NI5rd35scZlK8cAMbMt+4FWL4oGF0=

@fnetX commented on GitHub (Mar 1, 2022): GitHub doesn't like the attachment, here it is: https://drop.infini.fr/r/7MUEnQ7peK#dOh5b/4ZxsaDEZQVFH5+2q/kdh1z3NB3KY7IL8Ck3p8= ![Screenshot from 2022-03-01 16-22-05](https://user-images.githubusercontent.com/19634137/156196679-76416675-52be-44aa-a26e-ce0734e17610.png) (for 1.16 where this is better reproducible for me) --- and for main on try.gitea.io (language dropdown) ![Screenshot from 2022-03-01 16-25-41](https://user-images.githubusercontent.com/19634137/156197216-cce2c7f6-eef6-42e5-948c-01f1e8cba66f.png) https://drop.infini.fr/r/tHZYm6jhkK#5gDA5xbVVZbl/9NI5rd35scZlK8cAMbMt+4FWL4oGF0=
Author
Owner

@fnetX commented on GitHub (Mar 1, 2022):

If there is a chance this is really improved in main, I can wait and close this issue. But it's annoying me for a long time and always got worse, with 1.16 being the slowest of the releases, so I finally reported it. But main finally seems to be faster.

@fnetX commented on GitHub (Mar 1, 2022): If there is a chance this is really improved in main, I can wait and close this issue. But it's annoying me for a long time and always got worse, with 1.16 being the slowest of the releases, so I finally reported it. But main finally seems to be faster.
Author
Owner

@silverwind commented on GitHub (Mar 1, 2022):

IIRC, these are pure js animations (seen by the css) calls in the flamechart. I think fomantic has a switch somewhere to disable these animations, and I guess we should disable them, at least then the user indicated preference for reduced motion.

@silverwind commented on GitHub (Mar 1, 2022): IIRC, these are pure js animations (seen by the `css`) calls in the flamechart. I think fomantic has a switch somewhere to disable these animations, and I guess we should disable them, at least then the user indicated preference for [reduced motion](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion).
Author
Owner

@Gusted commented on GitHub (Mar 1, 2022):

IIRC, these are pure js animations (seen by the css) calls in the flamechart. I think fomantic has a switch somewhere to disable these animations, and I guess we should disable them, at least then the user indicated preference for reduced motion.

Why fonantic? This slideToggle is handled by jQuery, you can disable the jQuery's animations by the fx option: https://api.jquery.com/jquery.fx.off/

Btw, this slow performance is noticeable both on a slow laptop + high-end PC, not much of a difference(mainly because jQuery is using a lot of JS + manual CSS to handle this animation).

@Gusted commented on GitHub (Mar 1, 2022): > IIRC, these are pure js animations (seen by the `css`) calls in the flamechart. I think fomantic has a switch somewhere to disable these animations, and I guess we should disable them, at least then the user indicated preference for [reduced motion](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion). Why fonantic? This `slideToggle` is handled by jQuery, you can disable the jQuery's animations by the `fx` option: https://api.jquery.com/jquery.fx.off/ Btw, this slow performance is noticeable both on a slow laptop + high-end PC, not much of a difference(mainly because jQuery is using a lot of JS + manual CSS to handle this animation).
Author
Owner

@wxiaoguang commented on GitHub (Mar 1, 2022):

The dropdown animation comes from common-global.js:

  $('.slide.up.dropdown').dropdown({
    transition: 'slide up',
    fullTextSearch: 'exact'
  });

@fnetX Could you try to use this patch to test if the speed is better?

  $('.slide.up.dropdown').dropdown({
    transition: 'slide up',
    duration: 0,  // disable animation
    fullTextSearch: 'exact'
  });
@wxiaoguang commented on GitHub (Mar 1, 2022): The dropdown animation comes from `common-global.js`: ```js $('.slide.up.dropdown').dropdown({ transition: 'slide up', fullTextSearch: 'exact' }); ``` @fnetX Could you try to use this patch to test if the speed is better? ```js $('.slide.up.dropdown').dropdown({ transition: 'slide up', duration: 0, // disable animation fullTextSearch: 'exact' }); ```
Author
Owner

@fnetX commented on GitHub (Mar 1, 2022):

Hmm, this has no noticable effect. Also, the dropdown still appears to be animated here.

I'm closing this -- while testing I noticed that the performance with upstream Gitea is okay (I notice a small lag and considered this as "reproducible", but for normal use this is completely okay, and I probably would not have bothered reporting it. The issue is worse on codeberg and codeberg-test, that's why I started investigating after all. But building the codeberg branch locally is working fine. I think I'll try and investigate on my own what's the cause of this.)

@fnetX commented on GitHub (Mar 1, 2022): Hmm, this has no noticable effect. Also, the dropdown still appears to be animated here. I'm closing this -- while testing I noticed that the performance with upstream Gitea is okay (I notice a small lag and considered this as "reproducible", but for normal use this is completely okay, and I probably would not have bothered reporting it. The issue is worse on codeberg and codeberg-test, that's why I started investigating after all. But building the codeberg branch locally is working fine. I think I'll try and investigate on my own what's the cause of this.)
Author
Owner

@wxiaoguang commented on GitHub (Mar 2, 2022):

I have tested my patch, it does disable the animation of the Language dropdown (well, it doesn't affect some others). You could add duration: 0, to all $(...).dropdown({...}) in JS to disable most dropdown animations.

If you want to test the performance, you can use that patch and see whether the Language dropdown becomes better.

And I think there is no related changes between 1.16/1.17, so these versions should behave the same.

@wxiaoguang commented on GitHub (Mar 2, 2022): I have tested my patch, it does disable the animation of the Language dropdown (well, it doesn't affect some others). You could add `duration: 0,` to all `$(...).dropdown({...})` in JS to disable most dropdown animations. If you want to test the performance, you can use that patch and see whether the Language dropdown becomes better. And I think there is no related changes between 1.16/1.17, so these versions should behave the same.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#8637