Portfile Workflow Advice

Sean Farley sean at macports.org
Tue Jan 15 21:18:37 PST 2013


On Tue, Jan 15, 2013 at 11:10 PM, Ryan Schmidt <ryandesign at macports.org> wrote:
> On Jan 15, 2013, at 23:02, Sean Farley wrote:
>> On Tue, Jan 15, 2013 at 10:48 PM, Ryan Schmidt wrote:
>>> On Jan 15, 2013, at 13:17, Sean Farley wrote:
>>>> For me, this command takes:
>>>>
>>>> $ time find $MP/dports -maxdepth 3 -name Portfile -exec echo {} \;
>>>> -exec grep -E -- "AUTHORS" {} \; | grep -B1 -v -E "/Portfile"
>>>>
>>>> real 1m2.393s
>>>> user 0m18.293s
>>>> sys 0m19.905s
>>>
>>> I really love my new Mac's SSD. Makes grepping all the portfiles much faster. It took several minutes on my old Mac. The above took 15s for me just now.
>>
>> Huh. I have a ssd as well (a new macbook pro, actually) so I don't see
>> why it would be an order of magnitude faster for you. Odd. I wonder if
>> something's cached?
>
> Oops, I neglected to remove the newline before pasting into the terminal so I only ran the first line. Running the full command gets about the same times as you:
>
> real    1m18.696s
> user    0m16.514s
> sys     0m18.815s

Aha, that would explain it!

> However the command I would usually run is faster:
>
> $ time find $MP/dports -name Portfile | xargs grep AUTHORS
>
> real    0m5.767s
> user    0m0.368s
> sys     0m3.315s

Yeah, it should be no secret that I'm not a guru with find+exec by now ;-)

>>> How and when is the csearch index updated? I like that grep gets me completely up-to-date results every time.
>>
>> It's manual but cindex updates itself in ~7s (depending on the number
>> of changed files) for me and is more than just macports (it's all my
>> code on my hard drive, in fact). I usually run it after pulling new
>> changes. But really, for me at least, code doesn't change fast enough
>> for me to care about hitting false-postives or whatnot; plus what I'm
>> usually searching for is an example so all I really want is the
>> location of a handful of files.
>
> That is true.

Side note: search all projects comes in really handy when working with
dependencies (i.e. definitions / examples would sometimes live in
another project's root).


More information about the macports-dev mailing list