auspice icon indicating copy to clipboard operation
auspice copied to clipboard

Performance: Genotype text entry field becomes sluggish once first comma entered

Open corneliusroemer opened this issue 2 years ago • 5 comments

Current Behavior
When I select "color by">"Genotype" and then start entering a list of sites, e.g. select "S" then 95,142 Auspice becomes sluggish as soon as I've typed the first comma. Auspice becomes so slow/unresponsive, that often it will not register keys pressed, ignore commas entered, etc.

Expected behavior
Text entry is smooth, no lagging, no dropped entries

Your environment: if browsing Nextstrain online

  • Operating system: Mac
  • Browser: Brave and Firefox

Additional context
The lagging seems to be because Auspice calculates immediately, after every character is added. There should probably be either a bit of a delay (2s) to reduce the number of recalculation. Somehow Auspice blocks when recalculating.

corneliusroemer avatar Oct 12 '21 20:10 corneliusroemer

I can't reproduce this behavior (on Firefox). Auspice has a 400ms debounce on keypresses here, and I can see this being used both when entering one position and when entering in a second.

jameshadfield avatar Oct 14 '21 02:10 jameshadfield

Using Chrome, I don't get this with the Global or Regional builds.

I do get this, somewhat, on my largest builds, like Delta: https://nextstrain.org/groups/neherlab/ncov/21A.Delta - though it's maybe a second to wait after the first colouring. My guess would be this is a colouring issue (as in, it takes a second to colour a very big tree) rather than something specific to the genotype type-box.

emmahodcroft avatar Oct 14 '21 08:10 emmahodcroft

One thing that can make this somewhat annoying is that once you type in an initial position and it loads, it will erase a comma if you typed one. If you assume that your typed comma is still present, you end up adding more numbers to the first position. Tried to illustrate this below - see the comma disappear - then I have to type it again (because I know this happens) typingLag

(FYI - the lag in typing is mostly mediated by auspice, not me - though I wait until the comma disappears before I keep typing, but the lag between characters 1 & 2 in the second position is not me)

As another note, there are two ways to tackle this as a user- one is to stop typing after position 1 & wait for the comma to disappear. (I think it's natural to stop typing after each position to see it 'happen', but one might not expect the comma to disappear.) The other is to power through and keep typing - auspice waits for no typing before it starts to load, so if you know the positions and just power through, you can get them all in and load them at once.

emmahodcroft avatar Oct 14 '21 08:10 emmahodcroft

It may not be totally trivial to reproduce and put in words what happens exactly, which is why I tagged it performance. I will try to record a video together with key presses to show the problem better.

Emma is getting there with her comma deletion. One problem is that the field seems to autocorrect what I'm trying to do. If I enter too may digits like 123456 it will auto truncate and do that very sluggishly.

corneliusroemer avatar Oct 14 '21 10:10 corneliusroemer

400ms after the last keypress a function will run which, judging by observation, may (i) remove a trailing comma, (ii) change the entered position if it's not valid and (iii) make auspice unresponsive while the colouring is recomputed and the screen is painted. All of these can be improved (the speed one is harder, but still very possible).

jameshadfield avatar Oct 14 '21 20:10 jameshadfield