darcs

Patch 596 make optimize garbage collect ...)

Title make optimize garbage collect ...)
Superseder Nosy List gh
Related Issues
Status accepted Assigned To
Milestone

Created on 2011-04-19.15:14:32 by gh, last changed 2011-07-26.20:22:55 by ganesh.

Files
File name Status Uploaded Type Edit Remove
make-optimize-garbage-collect-pristine-before-any-other-optimization.dpatch gh, 2011-04-19.15:14:31 application/x-darcs-patch
unnamed gh, 2011-04-19.15:14:31 text/x-darcs-patch
unnamed gh, 2011-04-19.15:14:31
See mailing list archives for discussion on individual patches.
Messages
msg13948 (view) Author: gh Date: 2011-04-19.15:14:31
I've screened it by mistake before sending it on the patch tracker, so
here it is.

1 patch for repository http://darcs.net:

Wed Apr  6 10:38:14 CEST 2011  Guillaume Hoffmann <guillaumh@gmail.com>
  * make optimize garbage collect pristine before any other optimization
  This has the effect that optimize --http produces a minimal
  basic.tar.gz pack.
Attachments
msg14448 (view) Author: galbolle Date: 2011-05-20.14:15:30
hunk ./src/Darcs/Commands/Optimize.hs 145
>  optimizeCmd origopts _ = do
>      when (UpgradeFormat `elem` origopts) optimizeUpgradeFormat
>      withRepoLock opts $ RepoJob $ \repository -> do
> +    cleanRepository repository -- garbage collect pristine.hashed
directory
>      when (OptimizeHTTP `elem` origopts) $ doOptimizeHTTP repository
>      if (OptimizePristine `elem` opts)
>         then doOptimizePristine repository

hunk ./src/Darcs/Commands/Optimize.hs 149
> -       else do cleanRepository repository
> -               when (Reorder `elem` opts) $ doReorder opts repository
> +       else do when (Reorder `elem` opts) $ doReorder opts repository
>                 doOptimizeInventory repository
>                 when (Compress `elem` opts || UnCompress `elem` opts) $
>                      optimizeCompression opts

When optimizing pritine, we now garbage collect it beforehand. I guess
it's innocuous Applying.
msg14454 (view) Author: mornfall Date: 2011-05-22.08:12:08
Hi,

Florent Becker <bugs@darcs.net> writes:
> hunk ./src/Darcs/Commands/Optimize.hs 145
>>  optimizeCmd origopts _ = do
>>      when (UpgradeFormat `elem` origopts) optimizeUpgradeFormat
>>      withRepoLock opts $ RepoJob $ \repository -> do
>> +    cleanRepository repository -- garbage collect pristine.hashed
> directory
>>      when (OptimizeHTTP `elem` origopts) $ doOptimizeHTTP repository
>>      if (OptimizePristine `elem` opts)
>>         then doOptimizePristine repository
>
> hunk ./src/Darcs/Commands/Optimize.hs 149
>> -       else do cleanRepository repository
>> -               when (Reorder `elem` opts) $ doReorder opts repository
>> +       else do when (Reorder `elem` opts) $ doReorder opts repository
>>                 doOptimizeInventory repository
>>                 when (Compress `elem` opts || UnCompress `elem` opts) $
>>                      optimizeCompression opts
>
> When optimizing pritine, we now garbage collect it beforehand. I guess
> it's innocuous Applying.

Are we sure that cleanRepository does not also garbage-collect the
cache? Because that is pretty expensive. (We may want to stop any
commands from implicitly crawling the cache, even.)

Yours,
   Petr

-- 
id' Ash = Ash; id' Dust = Dust; id' _ = undefined
msg14456 (view) Author: gh Date: 2011-05-22.17:32:32
> Are we sure that cleanRepository does not also garbage-collect the
> cache? Because that is pretty expensive. (We may want to stop any
> commands from implicitly crawling the cache, even.)

Indeed, the function Darcs.Repository.Cache.cleanCachesWithHint' is
called in the process of calling
Darcs.Repository.HashedRepo.cleanPristine, which means the function
name is quite misleading.

A quick todo-fix would be to rename cleanPristine to
cleanPristineAndCaches to make the problem more apparent.

By the way, before this patch, running "darcs optimize" already made
this cache crawling happen anyway, and I did not find it particularly
long on my low-performance netbook. But I agree it's better to make it
an subcommand of optimize ("darcs optimize --clean-caches").

guillaume
msg14457 (view) Author: mornfall Date: 2011-05-22.18:15:24
Guillaume Hoffmann <guillaumh@gmail.com> writes:

> By the way, before this patch, running "darcs optimize" already made
> this cache crawling happen anyway, and I did not find it particularly
> long on my low-performance netbook. But I agree it's better to make it
> an subcommand of optimize ("darcs optimize --clean-caches").

Yes, I know, and so does darcs check AFAIR. It takes many seconds on my
laptop -- it really doesn't depend on the CPU though, it's mostly IO
bound: if you have an SSD, or a small cache, you should be good. I have
over a gigabyte of cache, with almost 140000 files in it, and it is a
pain in the bottom every time darcs decides to crawl it (especially so
when it is out of pagecache, which is most of the time).

I wonder why I never filed this in the tracker, though...

Yours,
   Petr

-- 
id' Ash = Ash; id' Dust = Dust; id' _ = undefined
History
Date User Action Args
2011-04-19 15:14:32ghcreate
2011-05-08 17:36:20ganeshsetstatus: needs-screening -> needs-review
2011-05-20 14:15:30galbollesetstatus: needs-review -> accepted-pending-tests
messages: + msg14448
2011-05-22 08:12:08mornfallsetmessages: + msg14454
2011-05-22 17:32:32ghsetmessages: + msg14456
2011-05-22 18:15:24mornfallsetmessages: + msg14457
title: make optimize garbage collect pristine before any othe... -> make optimize garbage collect ...)
2011-07-26 20:22:55ganeshsetstatus: accepted-pending-tests -> accepted