optimising "change CWD" algorithm in subshell mode



Dear MC team,

This is just an idea of improvement.

At the moment MC is quite ineffectively changing current working
directory (CWD) in subshell mode.

What's happening is MC sends full path of a directory we're we want to
change to the (bash) shell.

For example if current working directory is /1/2/3/4/5 and we want to
change to /1/2/3/4/5/6 MC sends "cd /1/2/3/4/5/6" to bash when in
reality one would likely to use "cd ./6" as long as it is just one hop
away from current directory.

Changing directories in deeply nested trees becomes increasingly slower
as we travel deeper and deeper until MC is crashing when trying to
change to a very long path or hangs on hide panels operation, see

    https://www.midnight-commander.org/ticket/2072#comment:11

Worth noticing that major factor contributing to speed of changing
directories is not a depth but a length of a full path: if directory
names are long the slowdown becomes noticeable much sooner which also 
contributes to probability of crash.

So the idea is to optimise CWD algorithm a little by sending only
relative "cd" from CWD when possible.

Is it feasible?
How easy this can be implemented?

Cheers,
Dmitry.


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