darcs

Issue 1374 Reduce interdependency between modules

Title Reduce interdependency between modules
Priority feature Status resolved
Milestone Resolved in
Superseder Nosy List darcs-devel, dmitry.kurochkin, kowey, thorkilnaur, twb
Assigned To
Topics

Created on 2009-03-02.00:38:18 by twb, last changed 2009-08-27.14:17:01 by admin.

Files
File name Uploaded Type Edit Remove
deps.dot twb, 2009-03-02.23:31:27 application/msword
deps.sh twb, 2009-03-02.23:31:27 application/x-sh
deps.svg twb, 2009-03-02.23:31:27 image/svg+xml
Messages
msg7373 (view) Author: twb Date: 2009-03-02.00:38:16
Currently it seems that most changes to the source code (and in
particular, recording a patch, which causes ThisVersion to be updated)
require recompilation of many other modules.

Generate a dependency graph using graphviz (perhaps based on the
.depend file generated by GNUmakefile) and look for any simple
refactoring changes that could be done to reduce the number of arcs in
the graph.

This might be a suitable familiarization task for someone new to the
Darcs codebase.
msg7375 (view) Author: twb Date: 2009-03-02.06:58:16
On Sun, Mar 01, 2009 at 01:38:16PM +0000, Trent Buck wrote:
> Currently it seems that most changes to the source code (and in
> particular, recording a patch, which causes ThisVersion to be updated)
> require recompilation of many other modules.
> 
> Generate a dependency graph using graphviz (perhaps based on the
> .depend file generated by GNUmakefile) and look for any simple
> refactoring changes that could be done to reduce the number of arcs in
> the graph.

I got this far, but I couldn't work out an easy way to remove the
superfluous dependencies (short of reading in the whole tree and then
computing reachabilities).

ghc -M -dep-makefile deps.dot -Isrc $(find src \( -name \*.hs -o -name \*.lhs \)) &&
sed deps.dot \
    -e '/^#/d' \
    -e 's|src/||g' \
    -e 's/ : / -> /' \
    -e 's/\.\(o\|lhs\|hs\|hi\)//g' \
    -e '1idigraph {' \
    -e '$a}' \
    -e 's|/|_|g' |
dot -Tsvg >deps.svg

Currently the above script generates a 800kB SVG, or 40MB PNG.  The
only thing that could view it without being OOM-killed was Inkscape.
The graph it generates isn't readable anyway (because of all the extra
arcs).
msg7379 (view) Author: kowey Date: 2009-03-02.08:31:55
On Mon, Mar 02, 2009 at 06:58:20 -0000, Trent Buck wrote:
> I got this far, but I couldn't work out an easy way to remove the
> superfluous dependencies (short of reading in the whole tree and then
> computing reachabilities).
> 
> ghc -M -dep-makefile deps.dot -Isrc $(find src \( -name \*.hs -o -name \*.lhs \)) &&
> sed deps.dot \

graphviz provides a transitive reduction tool ('tred') which may help
msg7386 (view) Author: twb Date: 2009-03-02.23:31:27
On Sun, Mar 01, 2009 at 09:31:55PM +0000, Eric Kow wrote:
> On Mon, Mar 02, 2009 at 06:58:20 -0000, Trent Buck wrote:
> > I got this far, but I couldn't work out an easy way to remove the
> > superfluous dependencies (short of reading in the whole tree and then
> > computing reachabilities).
> > 
> > ghc -M -dep-makefile deps.dot -Isrc $(find src \( -name \*.hs -o -name \*.lhs \)) &&
> > sed deps.dot \
>
> graphviz provides a transitive reduction tool ('tred')

That works nicely.
Attached is a script, with the .dot and .svg it produces.
I had to run "cabal build" first to generate Context.hs for ghc -M.

Looking at this graph, what areas can we improve?  Without much
knowledge of the internals, I wonder how Darcs.Commands,
Darcs.CommandsAux and Darcs.TheCommands are related.  I also wonder if
Darcs.Externals is a useful grouping -- aren't the various modules it
depends on doing unrelated things?
Attachments
msg7391 (view) Author: kowey Date: 2009-03-03.08:48:10
On Mon, Mar 02, 2009 at 23:31:31 -0000, Trent Buck wrote:
> That works nicely.
> Attached is a script, with the .dot and .svg it produces.

Thanks.  It may be useful to have a version of this in which
Darcs.Commands is collapsed into one node.

> I had to run "cabal build" first to generate Context.hs for ghc -M.

> Looking at this graph, what areas can we improve?  Without much
> knowledge of the internals, I wonder how Darcs.Commands,
> Darcs.CommandsAux and Darcs.TheCommands are related.  I also wonder if
> Darcs.Externals is a useful grouping -- aren't the various modules it
> depends on doing unrelated things?

More in the internals, I do want to see a darcs-core library one
day with just the Darcs.Patch stuff
msg7620 (view) Author: kowey Date: 2009-04-09.11:29:30
Could we have some more specific goals out of this?
msg7687 (view) Author: twb Date: 2009-04-11.09:53:33
On Thu, Apr 09, 2009 at 11:29:32AM -0000, Eric Kow wrote:
> Could we have some more specific goals out of this?

The immediate, concrete issue was resolved by throwing away
Autoconf.hs.  Therefore I'm closing this ticket.

If someone wants to add specific targets, they can reopen it.
History
Date User Action Args
2009-03-02 00:38:18twbcreate
2009-03-02 06:58:20twbsetstatus: unread -> unknown
nosy: kowey, simon, twb, thorkilnaur, dmitry.kurochkin
messages: + msg7375
2009-03-02 08:31:57koweysetnosy: kowey, simon, twb, thorkilnaur, dmitry.kurochkin
messages: + msg7379
2009-03-02 23:31:31twbsetfiles: + deps.sh, deps.dot, deps.svg
nosy: kowey, simon, twb, thorkilnaur, dmitry.kurochkin
messages: + msg7386
2009-03-03 08:48:13koweysetnosy: kowey, simon, twb, thorkilnaur, dmitry.kurochkin
messages: + msg7391
2009-04-09 11:29:32koweysetpriority: feature
nosy: kowey, simon, twb, thorkilnaur, dmitry.kurochkin
messages: + msg7620
2009-04-11 09:53:35twbsetstatus: unknown -> resolved
nosy: kowey, simon, twb, thorkilnaur, dmitry.kurochkin
messages: + msg7687
2009-08-25 17:41:28adminsetnosy: + darcs-devel, - simon
2009-08-27 14:17:01adminsetnosy: kowey, darcs-devel, twb, thorkilnaur, dmitry.kurochkin