Possible speed enhancement



Hi,

I might have an idea for nautilus to improve browsing speed. I am using
openSUSE 11 and have both Gnome and KDE 4 installed. I was asked to
upgrade a Delphi program a couple of years ago, since it was very slow.
It basically used the Windows explorer table component to display device
properties. It worked fine for small lists of devices, but at one
location the program had to display 11,000 devices and it took 20minutes
to display the list during which time the GUI was locked. (I need to
mention also that there was no disk or network IO, since the list was
loaded using a named pipe from a service that have all devices in ram at
all times.

In any case, after some debugging (and loosing a CPU due to
overheating), I found that the component class sorted the entire list
every time you added an entry. This is acceptable up to 100 or even
1,000 items, but once the total reaches close to 10,000 it becomes
frustrating to work with it. I changed the loading algorithm to turn off
sorting when it added an item and set a timer to switch sorting back
after 250ms. Every time an item is added, the time at which the sorting
is switched back on, was delayed. (I needed such a mechanism, since I
had no access to the component code). That brought down the loading from
20 minutes to 3 or 4 seconds.

What this has to do with Nautilus:
Nautilus takes about 8 seconds to load up /usr/lib on my current PC
(about 2,300 files). KDE/dolphin takes about 2 seconds. I wrote a Java
table model to display files and mine also takes about 2 seconds getting
files via XMLRPC over a TCP/IP connection from a service that scans the
file system on request. I use nearly the same principle I did before,
but with once change. In stead of waiting until the folder is scanned
completely, I add batches of files at a time and sort after each batch.
So, if I happen to connect over a slow connection, the user can at least
see that the file list is growing. Also, the batch sizes are determined
by 2 factors. One is the minimum batch size and the other is a time
interval (of about 250ms). If either of the conditions are met, the next
batch of files are added to the table (this is done in the GUI thread,
while the loop that communicates is done in some background task). This
design also keeps the GUI active at all times (even if making the TCP/IP
connection takes some time). You can play around with batch sizes to get
the optimum.

I hope you can use this information to speed up Nautilus a bit - it
simply adds a lot to the user experience if an application is very
responsive.

Happy computing,

John



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]