# HG changeset patch # User Laman # Date 2016-03-26 12:56:44 # Node ID 3a359a8a2134889673ba6d2d9e8b0a7404daf9ed # Parent 72963904714e2c92b1a0e0b744800d162db1eb87 optimizing disk access diff --git a/work.py b/work.py --- a/work.py +++ b/work.py @@ -86,7 +86,7 @@ def transferChanges(targetPath): # transfer modified sectors and mark them as clean sectorIds=handle.fetchall() - for (sectorId,) in sectorIds: + '''for (sectorId,) in sectorIds: path=targetPath / getPath(sectorId) try: path.parent.mkdir(parents=True) except FileExistsError: pass @@ -94,16 +94,31 @@ def transferChanges(targetPath): sf.seek(sectorId) df.write(sf.read(BLOCK_SIZE)) handle.execute("""update `hashes` set `dirty`=0 where `sector_id`=?""",(sectorId,)) - db.commit() + db.commit()''' + sector=sf.read(BLOCK_SIZE) + i=j=0 + while sector and j