jitdb
jitdb copied to clipboard
Consider default pageSize value in toPullStream
I was looking at some numbers today and noticed that there was a significant overhead of using toPullStream in some cases. The following query takes 2.4 seconds:
pull(
ssb.db.query(
where(
and(
author('@QlCTpvY7p9ty2yOFrv1WU1AE88aoQc4Y7wYal7PFc+w=.ed25519')
)
),
toPullStream(),
pull.collect((err, results) => {
....
while:
ssb.db.query(
where(
and(
author('@QlCTpvY7p9ty2yOFrv1WU1AE88aoQc4Y7wYal7PFc+w=.ed25519')
)
),
toCallback((err, results) => {
....
takes 1.2s.
It turns out that toPullStream actually does pagination internally in all cases. Tweaking this number made quite a difference. So I'm wondering how this number came about? And if it should be something like maybe 1000 instead?
Hmm, yeah 20 might be too low. I think I came up with the number arbitrarily.
Remember this one? :)
Hmmm