eweitz / ideogram

Chromosome visualization for the web
https://eweitz.github.io/ideogram
Other
288 stars 72 forks source link

Speed up gene search in "Related genes" #285

Closed eweitz closed 2 years ago

eweitz commented 2 years ago

This makes gene search faster in the related genes kit. All searches after the first now use gene cache data, previously described in #284. This speeds up those gene searches by ~200 ms each.

In the uncached network flow below, note the big gap between the first and second request in the circled area.

Slow_uncached_gene_search__Ideogram_2021-11-18

That still applies for the very first search. However, as seen below, that time gap is eliminated for subsequent searches.

Fast_cached_gene_search__Ideogram_2021-11-18

Clients can also initialize the gene cache before search, if they're savvy, to get the 200 ms savings for initial gene search. But the optimizations for non-initial search shown above apply by default, out of the box.

(A brief experiment using IndexedDB and idb-keyval revealed that Cache is 12% faster for this use case. Structured cloning might be a main cause of slowness in IndexedDB.)

coveralls commented 2 years ago

Coverage Status

Coverage decreased (-0.2%) to 88.911% when pulling 50457cf2cd842f8646b7316d5dbfb3a8bd445f78 on faster-gene-search into 4495ca49455eb24dececc89666b2b7bac9420479 on master.