A large number of documents list optimization

Here you can propose new features, make suggestions etc.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
sunbinjin
Junior Member
Junior Member
Posts: 21
Joined: 2008-10-21, 03:47 UTC

A large number of documents list optimization

Post by *sunbinjin »

A large number of documents list optimization



There are 100000 HTML files in a folder, Windows Explorer into the time of 0 seconds, totalcmd entered the time of 5 seconds, to display the list of files



This should be optimized?
Sob
Power Member
Power Member
Posts: 945
Joined: 2005-01-19, 17:33 UTC

Post by *Sob »

Explorer cheats. :) It opens the folder immediately, while still loading files. The whole process takes some time. But you're right, there is a difference and quite a big one.

I created 200 000 files for testing, in empty directory, named from 1.txt to 200000.txt. Then I timed how long it takes to enter the directory, until everything is ready.

Windows 7 x64 Explorer (sorting by name ascending or descending, does not matter):
0 secs: press Enter on folder
+0 secs: folder opened and unsorted files appear, file counter at the bottom increases
+3 secs: all files loaded
+6 secs: all files sorted; that thing happening in path field at the top finishes (wonderful description, I know ;)

Total Commander (description without times):
1) press Enter on folder
2) folder icon changes to open, hourglass cursor appears, TC becomes unresponsive (window title does not say that, but user can't do anything)
3) some unsorted files appear in panel, TC shows loading window and becomes responsive again
4) TC hides loading window and again goes unresponsive
5) TC becomes responsive and sorted files appear in panel

And now the interesting thing with times:

Total Commander (sorting by name ascending):
(files returned by system are pretty much sorted already, because they were all created in this order)
1) 0 secs
2) +0 secs
3) +5 secs
4) +5 secs (loading window barely flashed)
5) +8 secs

Total Commander (sorting by name descending):
1) 0 secs
2) +0 secs
3) +5 secs
4) +19 secs (?!)
5) +22 secs

For me it brings two questions:
a) Where does that huge difference caused by sorting comes from? Is there a bubble sort? :)
b) What exactly happens between 4) and 5)? Whatever that is, shouldn't TC hide the loading window after that?

Also if it was my call, I would definitely shorten that 5 second delay, because it's way too long. I don't work with such huge directories often, but everytime I do, I always think TC locked up, before I remember that it might be because of huge number of files.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50873
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

No, TC uses insertion sort, which uses binary search and is as fast as quick sort.
Author of Total Commander
https://www.ghisler.com
Sob
Power Member
Power Member
Posts: 945
Joined: 2005-01-19, 17:33 UTC

Post by *Sob »

I must learn to avoid this kind of comments (bubble sort part), people always react on them and skip what's important. :)
User avatar
Hacker
Moderator
Moderator
Posts: 13144
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

Sob,
It might be worth checking with Process Monitor for any differences perhaps?

Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Post Reply