-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Hi,
I'm loading BigWig data for the whole genome, i.e., calling getFeatures for each chromosome. This results in many fetch requests, as expected.
However, the number of requests seems to be excessive (76), and many of them hit exactly the same range. For example, in the above case (https://genomespy.app/docs/grammar/data/lazy/#example_1), there are 25 requests hitting the same 49 byte range and other 25 requests hitting a same 8197 range. Because web browsers seem to be very bad at caching partial content, this results in quite a bit of latency.
There appears to be a caching mechanism in BlockView, but a new BlockView (and cache) is created for each getFeatures call.
Line 158 in d239d40
| private featureCache = new AbortablePromiseCache<ReadData, Buffer>({ |
Instead of having a new cache for each BlockView, could there be a single shared cache in the BBI class, which could be used by all BlockViews? In my example case, the number of requests would drop from 76 to 28.
I could make a PR at some point if this change is feasible and would not cause any undesired adverse effects.
