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?
A large number of documents list optimization
Moderators: Hacker, petermad, Stefan2, white
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.
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.
- ghisler(Author)
- Site Admin
- Posts: 50873
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
No, TC uses insertion sort, which uses binary search and is as fast as quick sort.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com