[darcs-devel] [patch1772] remove currentDirectory from TreeMonad

Ben Franksen bugs at darcs.net
Mon Dec 10 14:16:27 UTC 2018


Ben Franksen <ben.franksen at online.de> added the comment:

> This change doesn't affect whether darcs does filesystem operations
> relative to the current working directory, does it?

No, of course not. It just means you cannot zoom into a subtree as a
"built-in" operation of TreeMonad.

> A while ago ago we spent some time looking at whether we could stop
> darcs from depending on the current working directory for the 
> process, as it's implicit global state that makes it hard to use the 
> darcs library from multiple threads. One worry was that it would
> have a significant performance impact because it's slower for the OS
> to look up an absolute path than one relative to CWD. I think a
> factor of two was mentioned, but I have no idea what the current
> situation would be.

I guess it also depends on how long the path to the repository is. My
guess is that this is especially bad in Haskell, since all the IO
operations assume FilePath = String.

The problem with the current working directory is the file system API,
which for traditional reasons has only one working directory for the
whole process. A more modern API would allow the user to create multiple
working directories and to pass them explicitly (and interpret relative
paths using explicit working directories). We can emulate such a modern
API but this would be pointless, as it would rob us of the performance
improvement.

However, this is alltogether a different issue.

> The patch also has a lot of reformatting along with the logic
> changes that will make it harder to review.

I has some reformatting, I wouldn't say "a lot". The import list
reformat shouldn't be an issue for review. The existsAnycase function
has changes on almost all its code lines, so I saw no sense in
preserving the existing layout. The data type reformat could have been
left out, though, sorry for that.

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/patch1772>
__________________________________


More information about the darcs-devel mailing list