mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zhaoxiu Zeng <zengzhaoxiu@163.com>
To: Jann Horn <jannh@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	kernel list <linux-kernel@vger.kernel.org>,
	Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>
Subject: Re: [PATCH 2/3] lib: zlib_inflate: improves decompression performance
Date: Thu, 12 Nov 2020 00:06:09 +0800	[thread overview]
Message-ID: <2442c8fb-ff36-41ce-9349-d162639d5c3b@163.com> (raw)
In-Reply-To: <CAG48ez3OyH61+hJ+Azyoae0fA6=8tnVOw3VqKebCcH=dTvh2dg@mail.gmail.com>

在 2020/11/11 11:46, Jann Horn 写道:
> On Mon, Nov 9, 2020 at 8:27 PM <zengzhaoxiu@163.com> wrote:
>> This patch does:
>> 1. Cleanup code and reduce branches
>> 2. Use copy_from_back to copy the matched bytes from the back output buffer
> 
> What exactly is copy_from_back()? Is it like memmove()? If yes, have
> you tried using memmove() instead of the code added in patch 1/3?
> 

If use memcpy(or memmove), the code will be like this:
	while (dist < len) {
		memcpy(out, out - dist, dist);
		out += dist;
		len -= dist;
	}
	memcpy(out, out - dist, len);
or:
	const u8 * const from = out - dist;
	while (dist < len) {
		memcpy(out, from, dist);
		out += dist;
		len -= dist;
		dist *= 2;
	}
	memcpy(out, from, len);

In addition, the len is small in most cases, so the function calls are expensive.


  reply	other threads:[~2020-11-11 16:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-09 19:16 [PATCH 1/3] lib: Introduce copy_from_back() zengzhaoxiu
2020-11-09 19:25 ` [PATCH 2/3] lib: zlib_inflate: improves decompression performance zengzhaoxiu
2020-11-11  3:46   ` Jann Horn
2020-11-11 16:06     ` Zhaoxiu Zeng [this message]
2020-11-12  0:06       ` Jann Horn
2020-11-12  6:45   ` [lib] 6ee736dc92: BUG:unable_to_handle_page_fault_for_address kernel test robot
2020-11-16 17:32     ` Zhaoxiu Zeng
2020-11-09 19:28 ` [PATCH 3/3] lib: lzo: Improves decompression performance zengzhaoxiu
2020-11-16 16:35 ` [PATCH 1/3] lib: Introduce copy_from_back() Christoph Hellwig
2020-11-16 17:22   ` Zhaoxiu Zeng
2020-11-16 17:24     ` Christoph Hellwig
2020-11-18 15:10       ` Zhaoxiu Zeng

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=2442c8fb-ff36-41ce-9349-d162639d5c3b@163.com \
    --to=zengzhaoxiu@163.com \
    --cc=akpm@linux-foundation.org \
    --cc=jannh@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zhaoxiu.zeng@gmail.com \
    /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®