sqlite and misc optimizations:

* exponentially slow upload handshakes caused by lack of rd+fn
   sqlite index; became apparent after a volume hit 200k files
* listing big folders 5% faster due to `_quotep3b`
* optimize `unquote`, 20% faster but only used rarely
* reindex on startup 150x faster in some rare cases
   (same filename in MANY folders)

the database is now around 10% larger (likely worst-case)
This commit is contained in:
ed 2024-09-15 13:18:43 +00:00
parent 2927bbb2d6
commit d67e9cc507
5 changed files with 146 additions and 43 deletions

View file

@ -5143,7 +5143,6 @@ class HttpCli(object):
dirs.append(item)
else:
files.append(item)
item["rd"] = rem
if is_dk and not vf.get("dks"):
dirs = []
@ -5166,16 +5165,10 @@ class HttpCli(object):
add_up_at = ".up_at" in mte
is_admin = self.can_admin
tagset: set[str] = set()
for fe in files:
rd = vrem
for fe in files if icur else []:
assert icur # !rm
fn = fe["name"]
rd = fe["rd"]
del fe["rd"]
if not icur:
continue
if vn != dbv:
_, rd = vn.get_dbv(rd)
erd_efn = (rd, fn)
q = "select mt.k, mt.v from up inner join mt on mt.w = substr(up.w,1,16) where up.rd = ? and up.fn = ? and +mt.k != 'x'"
try: