after analyzing the different options to read a dir, we found out that bzrlib is not faster than using (listdir + os.stat).
Besides, seems like there is no straightforward way of adding bzrlib as a ubuntuone-client dependency, so at first we're leaving the current LR code as is. It's worth noting that the big bottle neck on SyncDaemon startup is the loading of metadata, not the local rescan time.
Below some samples and the results. Please let me know if you think we're missing something!
nessita@miro:~$ cat test_bzrlib.py
from bzrlib._readdir_pyx import UTF8DirReader
dirpath = "/usr/lib"
i = 0
for info in UTF8DirReader().read_dir(dirpath, dirpath):
i += 1
Robert,
after analyzing the different options to read a dir, we found out that bzrlib is not faster than using (listdir + os.stat).
Besides, seems like there is no straightforward way of adding bzrlib as a ubuntuone-client dependency, so at first we're leaving the current LR code as is. It's worth noting that the big bottle neck on SyncDaemon startup is the loading of metadata, not the local rescan time.
Below some samples and the results. Please let me know if you think we're missing something!
nessita@miro:~$ cat test_bzrlib.py
from bzrlib._readdir_pyx import UTF8DirReader
dirpath = "/usr/lib" ).read_ dir(dirpath, dirpath):
i = 0
for info in UTF8DirReader(
i += 1
print "Called bzrlib. UTF8DirReader on %s. Read %i entries." % (dirpath, i)
nessita@miro:~$ cat test_listdir.py
import os
dirpath = "/usr/lib" dirpath) : join(dirpath, something)
i = 0
for something in os.listdir(
fullname = os.path.
stat_result = os.lstat(fullname)
i += 1
print "Called listdir + os.lstat on %s. Read %i entries." % (dirpath, i)
nessita@miro:~$ time python test_listdir.py
Called listdir + os.lstat on /usr/lib. Read 2224 entries.
real 0m0.054s
user 0m0.028s
sys 0m0.024s
nessita@miro:~$ time python test_bzrlib.py UTF8DirReader on /usr/lib. Read 2224 entries.
Called bzrlib.
real 0m0.053s
user 0m0.032s
sys 0m0.020s
nessita@miro:~$