It occurs to me that cobra appears to compile files every time you run cobra rather than only when they have changed. Any chance you could add this to some point on your (no doubt) incredibly long todo list? Given it's not the fastest compiler ever, it would make a meaningful time difference if this were fixed.
I don't know how other languages do this, whether they simply look at the time stamp or whether they embed some md5sum of the source into the generated file - I suspect the former (which may well lead to issues when running across network shares)
Forums
Compiler missing up-to-date checking?
7 posts
• Page 1 of 1
Re: Compiler missing up-to-date checking?
Yeah, it's missing and I agree it should be there. I'll take a look, but of course, patches are always nice!
Anyone know exactly what rules Python uses?
I'm part way through with event declarations and class extensions both of which I hope to finish this week or weekend, so it probably won't be this week.
-Chuck
Anyone know exactly what rules Python uses?
I'm part way through with event declarations and class extensions both of which I hope to finish this week or weekend, so it probably won't be this week.
-Chuck
- Charles
- Posts: 2515
- Location: Los Angeles, CA
Re: Compiler missing up-to-date checking?
Well, python/perl etc are special cases as they tend not to leave any object files around, so they just compile every time.
Empirically boo compiles everything every time (I gave up poking around in the code to try to find the place where the compiling actually happens TooManyPipelinesException - how many virtually empty classes can you need?). In any event I'm told that things like gcc also just compile everything every time - apparently it's make that handles working out what needs compiling and what doesn't, and that's done by simply comparing last modified times.
The wrinkle is that if a depends on b, then if a.in has been modified since it was last compiled then a.out needs to be regenerated. However, if b.in has been modified since the creation of b.out then b.out needs to be regenerated, and a.out ought to be regenerated in case something in b.out has changed that stops a.out from compiling. (where a.in is the source file and a.out is the compiled file). Doing things properly is therefore a non-trivial problem (it's only easy in make because make is always told explicitly what depends on what). However, javac definitely manages to do it, and I dare say that mcs must do too.
... some time later ...
Indeed my hunch was right: see the NeedsCompiling method in http://nant.cvs.sourceforge.net/nant/nant/src/NAnt.DotNet/Tasks/CompilerBase.cs?revision=1.104&view=markup%20CompilerBase
Want me to see if I can knock up a cobra nant task?
Empirically boo compiles everything every time (I gave up poking around in the code to try to find the place where the compiling actually happens TooManyPipelinesException - how many virtually empty classes can you need?). In any event I'm told that things like gcc also just compile everything every time - apparently it's make that handles working out what needs compiling and what doesn't, and that's done by simply comparing last modified times.
The wrinkle is that if a depends on b, then if a.in has been modified since it was last compiled then a.out needs to be regenerated. However, if b.in has been modified since the creation of b.out then b.out needs to be regenerated, and a.out ought to be regenerated in case something in b.out has changed that stops a.out from compiling. (where a.in is the source file and a.out is the compiled file). Doing things properly is therefore a non-trivial problem (it's only easy in make because make is always told explicitly what depends on what). However, javac definitely manages to do it, and I dare say that mcs must do too.
... some time later ...
Indeed my hunch was right: see the NeedsCompiling method in http://nant.cvs.sourceforge.net/nant/nant/src/NAnt.DotNet/Tasks/CompilerBase.cs?revision=1.104&view=markup%20CompilerBase
Want me to see if I can knock up a cobra nant task?
- themaniac
- Posts: 28
Re: Compiler missing up-to-date checking?
themaniac wrote:Well, python/perl etc are special cases as they tend not to leave any object files around, so they just compile every time.
For importing modules, Python caches byte code (.pyc) on disk. It only recompiles if needed. For whatever reason it won't do this with scripts that you run. So often people make a two line script to get the effect ("import proglib; proglib.run()").
I think Cobra should use the same logic for .exe's. It doesn't really need to follow dependencies other than looking at all source files that it was passed. If someone needs something more complex then it's time for nant, msbuild or make.
themaniac wrote:Want me to see if I can knock up a cobra nant task?
Yep, that would be a welcome contribution!
- Charles
- Posts: 2515
- Location: Los Angeles, CA
Re: Compiler missing up-to-date checking?
patch provided for ticket:14
- hopscc
- Posts: 632
- Location: New Plymouth, Taranaki, New Zealand
Re: Compiler missing up-to-date checking?
I can't get to this tonight. Will take a look tomorrow.
- Charles
- Posts: 2515
- Location: Los Angeles, CA
7 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 0 guests