TabbycatDebate / tabbycat

Debating tournament tabulation software for British Parliamentary and a variety of two-team parliamentary formats
https://tabbycat.readthedocs.io/
GNU Affero General Public License v3.0
247 stars 841 forks source link

Improve Tabbycat's table handling #2503

Open teymour-aldridge opened 1 month ago

teymour-aldridge commented 1 month ago

Tabbycat's table rendering seems to be quite slow currently; for example to load the WUDC 2024 tab on my computer takes about 12s. For example, here is a profile taken in Chromium

image

Chromium spends about 6.4s executing the Javascript code, and then 4s parsing the resulting HTML. However, if I save the final page as a file and then load it in Chrome it takes about 155.61ms to fully render the page. The page itself also feels much more responsive

image

I wonder if it might not be a good idea to completely remove the Vue.js Javascript code and just render tables directly as HTML?

tienne-B commented 1 month ago

I'd actually be more inclined in making more use of Vue.js to improve interactivity than giving up with Vue altogether here. One of my projects is actually exactly that: https://github.com/TabbycatDebate/tabbycat-frontend . There must be some performance things we can do here, or add a "loading" state, but I'm actually not well familiar with Vue here. The example is also extreme with a very large tournament...

teymour-aldridge commented 1 month ago

I've renamed this to improve Tabbycat's table handling because I think the table pages are currently some of the slowest (and could probably be relatively easily improved). I am a bit perplexed at the numbers (I think a 300 line table is relatively small) so when I have some time I'll try to do some more detailed profiling (e.g. try to get some flamegraphs of what the Javascript code is doing) to work out exactly what is causing this to be slow.

At the same time it would probably make sense to clean up the table generation code because (as mentioned in https://github.com/TabbycatDebate/tabbycat/issues/1464) it has become pretty unwieldy.