mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 00:52:16 -06:00
tag-scanner perf
This commit is contained in:
parent
680f8ae814
commit
4e7455268a
|
@ -1193,19 +1193,19 @@ class Up2k(object):
|
||||||
|
|
||||||
w = bw[:-1].decode("ascii")
|
w = bw[:-1].decode("ascii")
|
||||||
|
|
||||||
q = "select rd, fn from up where w = ?"
|
with self.mutex:
|
||||||
try:
|
try:
|
||||||
rd, fn = cur.execute(q, (w,)).fetchone()
|
q = "select rd, fn from up where substr(w,1,16)=? and +w=?"
|
||||||
except:
|
rd, fn = cur.execute(q, (w[:16], w)).fetchone()
|
||||||
# file modified/deleted since spooling
|
except:
|
||||||
continue
|
# file modified/deleted since spooling
|
||||||
|
continue
|
||||||
|
|
||||||
if rd.startswith("//") or fn.startswith("//"):
|
if rd.startswith("//") or fn.startswith("//"):
|
||||||
rd, fn = s3dec(rd, fn)
|
rd, fn = s3dec(rd, fn)
|
||||||
|
|
||||||
if "mtp" in flags:
|
if "mtp" in flags:
|
||||||
q = "insert into mt values (?,'t:mtp','a')"
|
q = "insert into mt values (?,'t:mtp','a')"
|
||||||
with self.mutex:
|
|
||||||
cur.execute(q, (w[:16],))
|
cur.execute(q, (w[:16],))
|
||||||
|
|
||||||
abspath = os.path.join(ptop, rd, fn)
|
abspath = os.path.join(ptop, rd, fn)
|
||||||
|
@ -1219,6 +1219,7 @@ class Up2k(object):
|
||||||
|
|
||||||
n_add += n_tags
|
n_add += n_tags
|
||||||
n_buf += n_tags
|
n_buf += n_tags
|
||||||
|
nq -= 1
|
||||||
|
|
||||||
td = time.time() - last_write
|
td = time.time() - last_write
|
||||||
if n_buf >= 4096 or td >= max(1, self.timeout - 1):
|
if n_buf >= 4096 or td >= max(1, self.timeout - 1):
|
||||||
|
|
|
@ -8,7 +8,7 @@ cmd = sys.argv[1]
|
||||||
if cmd == "cpp":
|
if cmd == "cpp":
|
||||||
from copyparty.__main__ import main
|
from copyparty.__main__ import main
|
||||||
|
|
||||||
argv = ["__main__", "-v", "srv::r", "-v", "../../yt:yt:r"]
|
argv = ["__main__", "-vsrv::r:c,e2ds,e2ts"]
|
||||||
main(argv=argv)
|
main(argv=argv)
|
||||||
|
|
||||||
elif cmd == "test":
|
elif cmd == "test":
|
||||||
|
@ -29,6 +29,6 @@ else:
|
||||||
#
|
#
|
||||||
# python -m vmprof -o prof --lines ./scripts/profile.py test
|
# python -m vmprof -o prof --lines ./scripts/profile.py test
|
||||||
|
|
||||||
# linux: ~/.local/bin/vmprofshow prof tree | grep -vF '[1m 0.'
|
# linux: ~/.local/bin/vmprofshow prof tree | awk '$2>1{n=5} !n{next} 1;{n--} !n{print""}'
|
||||||
# macos: ~/Library/Python/3.9/bin/vmprofshow prof tree | grep -vF '[1m 0.'
|
# macos: ~/Library/Python/3.9/bin/vmprofshow prof tree
|
||||||
# win: %appdata%\..\Roaming\Python\Python39\Scripts\vmprofshow.exe prof tree
|
# win: %appdata%\..\Roaming\Python\Python39\Scripts\vmprofshow.exe prof tree
|
||||||
|
|
Loading…
Reference in a new issue