mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nick Terrell <terrelln@fb.com>
To: Colin King <colin.king@canonical.com>, Chris Mason <clm@fb.com>
Cc: "kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] lib: zstd: make const array rtbTable static, reduces object code size
Date: Fri, 22 Sep 2017 19:14:05 +0000	[thread overview]
Message-ID: <6C490CCD-32E1-4AC3-BCCF-5EB3A56EA887@fb.com> (raw)
In-Reply-To: <20170922145946.14316-1-colin.king@canonical.com>

On 9/22/17, 8:00 AM, "linux-kernel-owner@vger.kernel.org on behalf of Colin King" <linux-kernel-owner@vger.kernel.org on behalf of colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate const array rtbTable on the stack, instead make it
> static. Also split overly long line to clean a chechkpach warning.
> Makes the object code smaller by nearly 500 bytes:
> 
> Before:
>    text	   data	    bss	    dec	    hex	filename
>   13297	    104	      0	  13401	   3459	lib/zstd/fse_compress.o
> 
> After:
>    text	   data	    bss	    dec	    hex	filename
>   12742	    160	      0	  12902	   3266	lib/zstd/fse_compress.o
> 
> (gcc 6.3.0, x86-64)
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

I tested your patch with gcc-7.1 on x86, and benchmarked the speed on
upstream zstd. There isn't a noticeable speed difference, since it isn't a
particularly hot piece of code. Would you be able to submit the same patch
upstream [1], or would you be okay with me porting it back upstream, so it
doesn't get lost on an update?

I didn't expect gcc to leave constant arrays on the stack, that seems
silly. Clang makes it static, but gcc loads it onto the stack, and in 6.3+
it saves the data statically, and then uses vector instructions to load it
onto the stack [2].

Tested-by: Nick Terrell <terrelln@fb.com>

[1] https://github.com/facebook/zstd
[2] https://godbolt.org/g/fvTcED

  reply	other threads:[~2017-09-22 19:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-22 14:59 Colin King
2017-09-22 19:14 ` Nick Terrell [this message]
2017-09-22 21:34   ` Colin Ian King

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=6C490CCD-32E1-4AC3-BCCF-5EB3A56EA887@fb.com \
    --to=terrelln@fb.com \
    --cc=clm@fb.com \
    --cc=colin.king@canonical.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®