nextclade icon indicating copy to clipboard operation
nextclade copied to clipboard

BUG: Sequence display stops loading after ~20 sequences, resumes only once all sequences analyzed

Open corneliusroemer opened this issue 2 years ago • 3 comments

I've noticed that the web sequence displays stops updating after ~20 sequences are displayed. The table only updates once all sequences are analyzed, which can be quite some time if I'm aligning say 300 sequences.

Not sure why this happens, it wasn't the case in v1

Basically, it stalls at this stage for quite some time, see that in fact 179 sequences have been analyzed, yet the table only displays 22: image

corneliusroemer avatar Jun 27 '22 10:06 corneliusroemer

Now it stopped after 18 sequences, always at similar but not exactly same point image

corneliusroemer avatar Jun 27 '22 10:06 corneliusroemer

This likely happens because the new workers are much faster and in v2 the main thread gets overloaded by the incoming analysis results earlier than in v1.

Web platform has very limited concurrency/synchronization primitives, let alone any kind of priority mechanisms, so I don't see a solution for that right away.

If this is critical, we could introduce an artificial slowdown to worker threads, so that the messages come at a lower rate and main thread freezes a bit later in the process, when a screen-full of rows is already displayed. But it will depend on the virus, as well as browser and hardware and needs to be tuned for an "average" user and "average" virus somehow.

But the way it is right now ensures maximum performance - the analysis is as fast as it gets, even though it cannot be seen immediately and only rendered in large batches (when rendering code gets a time slice).

ivan-aksamentov avatar Jun 27 '22 16:06 ivan-aksamentov

I see, I'll tag it hard problem and we can see later on, it's a shame that due to fast performance it now becomes less usable when we analyse large numbers of sequences.

Maybe we could stall for a few tens of milliseconds every 20 sequences or so to give the main thread a chance to rerender?

corneliusroemer avatar Jun 27 '22 18:06 corneliusroemer