Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/4] pkg-download: check for already downloaded file in the download wrapper
Date: Wed, 3 Dec 2014 19:43:40 +0100	[thread overview]
Message-ID: <20141203184340.GE4152@free.fr> (raw)
In-Reply-To: <20141202092636.4bbfea66@free-electrons.com>

Thomas, All,

On 2014-12-02 09:26 +0100, Thomas Petazzoni spake thusly:
> On Tue,  2 Dec 2014 00:24:06 +0100, Yann E. MORIN wrote:
> > Instead of repeating the same test again and again in all our download
> > rules, just delegate the check for an already downloaded file to the
> > download wrapper.
> > 
> > This clears up the path for doing the hash checks on a cached file
> > before the download.
> > 
> > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> > Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> > Cc: Peter Korsgaard <jacmet@uclibc.org>
> > Cc: Gustavo Zacarias <gustavo@zacarias.com.ar>
> 
> It has the consequence of doing another fork+exec of a shell script for
> all files, even if they have already been downloaded. I don't know if
> this is really measurable compared to the overall build time, though,
> except maybe on some cases like "make source". So maybe this is OK.

Well, if I remember correctly, make is smart enough to detect simple
commands and not spawn a shell for them, and just does the fork-exec
itself rather than calling system().

So, when counting the fork+exec you'd get:

  - simple command (program arg arg arg): make does a fork()+exec() to
    the script, the kernel sees the she-bang and the exec is a call to
    the shell to interpret the script

  - command lists (command1 || command2), make does a system(), which in
    turn does a fork()+exec() to the shell to interpret the command
    list.

So we're breaking even in that case. We even gain a call to system(), so
we should be a little tiny bit faster! ;-p

And anyway, a fork+exec is not that costly nowaday. Probably, on a
cache-cold system, the IOs will largely over-shadow the fork+exec pair I
am afraid... ;-)

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

  reply	other threads:[~2014-12-03 18:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-01 23:24 [Buildroot] [PATCH 0/4] pkg-download: check hashes before the download (branch yem/download-hash) Yann E. MORIN
2014-12-01 23:24 ` [Buildroot] [PATCH 1/4] pkg-download: check for already downloaded file in the download wrapper Yann E. MORIN
2014-12-02  8:26   ` Thomas Petazzoni
2014-12-03 18:43     ` Yann E. MORIN [this message]
2014-12-01 23:24 ` [Buildroot] [PATCH 2/4] pkg-download: fix arguments to hash checking script Yann E. MORIN
2014-12-01 23:24 ` [Buildroot] [PATCH 3/4] pkg-download: verify the hashes from the download wrapper Yann E. MORIN
2014-12-02  8:29   ` Thomas Petazzoni
2014-12-03 18:45     ` Yann E. MORIN
2014-12-01 23:24 ` [Buildroot] [PATCH 4/4] pkg-download: check hasahes for locally cached files Yann E. MORIN
2014-12-02  8:31   ` Thomas Petazzoni
2014-12-02  9:27     ` Peter Korsgaard
2014-12-02  9:30       ` Thomas Petazzoni
2014-12-03 18:51     ` Yann E. MORIN
2014-12-06 12:44       ` Yann E. MORIN
2014-12-06 12:53         ` Thomas Petazzoni
2014-12-07 10:47           ` Yann E. MORIN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141203184340.GE4152@free.fr \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox