On Jan 19, 2009, at 1:58 PM, Chris Lattner wrote:> On Jan 19, 2009, at 10:02 AM, Mike Stump wrote: > >> There isn't a good reason to create files called .dir in the >> installation directory. This patch fixes that. > > If we don't have this line, every build with do the makedir.And? $ time mkdir -p /bin real 0m0.002s user 0m0.000s sys 0m0.002s an extra mkdir takes around 2ms per build. An up-to-date inc build takes 2231ms for me. If you want some of the extra 2231ms back, I'd recommend avoiding recursion in the makefiles. This will yield a larger benefit than worrying about the extra mkdir. If we have it, then .dir files are created in the installation directories. Trivially one can do: /dir: mkdir /dir /dir/prog: /dir gcc hi.c -o /dir/prog and avoid the extra mkdir, if one wanted. Any down side to doing that?
Dan Villiom Podlaski Christiansen
2009-Jan-20 11:46 UTC
[LLVMdev] avoid creating .dir files
On 20 Jan 2009, at 00:04, Mike Stump wrote:> On Jan 19, 2009, at 1:58 PM, Chris Lattner wrote: >> On Jan 19, 2009, at 10:02 AM, Mike Stump wrote: >> >>> There isn't a good reason to create files called .dir in the >>> installation directory. This patch fixes that. >> >> If we don't have this line, every build with do the makedir. > > And? > > $ time mkdir -p /bin > > real 0m0.002s > user 0m0.000s > sys 0m0.002s > > an extra mkdir takes around 2ms per build. An up-to-date inc build > takes 2231ms for me. If you want some of the extra 2231ms back, I'd > recommend avoiding recursion in the makefiles. This will yield a > larger benefit than worrying about the extra mkdir.Not that it really matters, but do note that the LLVM build system uses ‘$(LLVM_SRC_ROOT)/autoconf/mkinstalldirs’ for MKDIR, rather than just ‘mkdir’.> If we have it, then .dir files are created in the installation > directories. > > Trivially one can do: > > /dir: > mkdir /dir > > /dir/prog: /dir > gcc hi.c -o /dir/prog > > and avoid the extra mkdir, if one wanted. Any down side to doing > that?Yes, ‘prog’ will be remade every time a file as added to or removed from the directory. (I haven't checked just now, but I'm fairly certain that's what will happen.) One way to solve this is by using an order-only dependancy: /dir/prog: | /dir gcc hi.c -o /dir/prog This will cause GNU Make to ensure that /dir is made _before_ /dir/ prog, but without invalidating the /dir/prog target when /dir is updated/invalidated. Is it possible that I could get you to wait a bit with these changes? I just obtained commit access and set up a way to move over my changes from Mercurial to Subversion. I hope to have most of my changes to the build system integrated, and plan to post a proposal of how to get it done within the next few days or so. Apart from a general overhaul of the Makefiles, I integrated Clang into much of the LLVM build system, for instance ‘llvm-config’. -- Dan Villiom Podlaski Christiansen, stud. scient., danchr at cs.au.dk, danchr at gmail.com
On Jan 19, 2009, at 3:04 PM, Mike Stump wrote:> On Jan 19, 2009, at 1:58 PM, Chris Lattner wrote: >> On Jan 19, 2009, at 10:02 AM, Mike Stump wrote: >> >>> There isn't a good reason to create files called .dir in the >>> installation directory. This patch fixes that. >> >> If we don't have this line, every build with do the makedir. > > And? > > $ time mkdir -p /bin > > real 0m0.002s > user 0m0.000s > sys 0m0.002sOk! You win, :) -Chris> > > an extra mkdir takes around 2ms per build. An up-to-date inc build > takes 2231ms for me. If you want some of the extra 2231ms back, I'd > recommend avoiding recursion in the makefiles. This will yield a > larger benefit than worrying about the extra mkdir. > > If we have it, then .dir files are created in the installation > directories. > > Trivially one can do: > > /dir: > mkdir /dir > > /dir/prog: /dir > gcc hi.c -o /dir/prog > > and avoid the extra mkdir, if one wanted. Any down side to doing > that? > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu llvm.cs.uiuc.edu > lists.cs.uiuc.edu/mailman/listinfo/llvmdev
On Jan 20, 2009, at 12:46 PM, Dan Villiom Podlaski Christiansen wrote:> One way to solve this is by using an order-only dependancy:Cool. That's a good solution, with this, we can avoid the mkdir as well.> Is it possible that I could get you to wait a bit with these changes?No time like the present. I've used that incantation, feel free to suggest/make improvements. Also, I only did this for the installation directories, as those were the critical ones.