Re: Performance patch, dir.c:do_reload_dir() on large dirs.
- From: Pavel Roskin <proski gnu org>
- To: Björn Eriksson <mdeans algonet se>
- Cc: <mc gnome org>
- Subject: Re: Performance patch, dir.c:do_reload_dir() on large dirs.
- Date: Mon, 3 Dec 2001 16:44:34 -0500 (EST)
Hi, BjЖrn!
On Thu, 29 Nov 2001, [iso-8859-1] BjЖrn Eriksson wrote:
I had some problems with /tmp/ksocket/* when it contained ~20'000
files, all of the same length thus foiling the strlen() 'optimisation'.
Indeed, the time spent in reload_dir() grows as n^2 where n is the number
of entries. Perhaps it's possible to improve the algorithm e.g. to use
binary search in the old tree, but your workaround is simple and effective
when only few items are selected.
This small patch tries to skip the check-if-file-was-marked-in-the-
old-list-logic if no files we're marked at all. It considered
decrementing 'marked_cnt' for every found file but I think do_load_dir()
and do_reload_dir() would be better off with a hash table.
I'm adding a TODO comment about hash table.
There was a bug in your code - marked_cnt wasn't decreased when a marked
entry was matched. In other words, if you have 20000 entries with one
marked entry and the mark has already been transferred to the new list,
the remaining entries are still matched against the old list.
I'm applying your patch with this fix. Thank you!
BTW: lxr on gnome is:
1) not linked from the project page and
Please give URL. mc is listed at http://cvs.gnome.org/lxr/source/
2) not working, try src/dir.c
I confirm the problem at http://cvs.gnome.org/lxr/source/mc/src/dir.c
I'll report it to the LXR GNOME admin (Matt Wilson).
--
Regards,
Pavel Roskin
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]