All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Millan <rmh@aybabtu.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH] save around 100 bytes on core.img by inlining small misc.c functions
Date: Wed, 19 Aug 2009 17:11:23 +0200	[thread overview]
Message-ID: <20090819151123.GB7859@thorin> (raw)
In-Reply-To: <d7ead6de0908170654j7c2daa17j4cced19e8c8101a9@mail.gmail.com>

On Mon, Aug 17, 2009 at 03:54:06PM +0200, Vladimir 'phcoder' Serbinenko wrote:
> On Mon, Aug 17, 2009 at 3:43 PM, Robert Millan<rmh@aybabtu.com> wrote:
> > On Sat, Aug 15, 2009 at 04:47:32PM +0200, Vladimir 'phcoder' Serbinenko wrote:
> >> +static inline char *
> >> +grub_strncat (char *dest, const char *src, int c)
> >> +{
> >> +  char *p = dest;
> >> +
> >> +  while (*p)
> >> +    p++;
> >> +
> >> +  while ((*p = *src) != '\0' && c--)
> >> +    {
> >> +      p++;
> >> +      src++;
> >> +    }
> >> +
> >> +  *p = '\0';
> >> +
> >> +  return dest;
> >> +}
> >
> > Some of them (like this one) are surprisingly big.  Did you test them
> > separately?
> Yes I did. My test environment was a core.img with pc+fat+biosdisk. I
> have a log which functions save how much. In this case inlining
> strncat saved 21 bytes. The reason for some bigger functions to be
> inlined is that they are used only in non-size critical parts. In this
> case it's used in LUA and iso9660.mod (one call). So inlining strncat
> always saves space (even if iso9660.mod is in core.img but there is no
> size limit when booting from cd).

Ok, fine with me then.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."



  reply	other threads:[~2009-08-19 15:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-15 14:47 [PATCH] save around 100 bytes on core.img by inlining small misc.c functions Vladimir 'phcoder' Serbinenko
2009-08-17 13:43 ` Robert Millan
2009-08-17 13:54   ` Vladimir 'phcoder' Serbinenko
2009-08-19 15:11     ` Robert Millan [this message]
2009-08-24 19:40       ` Vladimir 'phcoder' Serbinenko

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=20090819151123.GB7859@thorin \
    --to=rmh@aybabtu.com \
    --cc=grub-devel@gnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.