Flexible I/O Tester development
 help / color / mirror / Atom feed
From: Jens Axboe <jaxboe@fusionio.com>
To: Steven Lang <tirea@google.com>
Cc: fio@vger.kernel.org
Subject: Re: [PATCH] Optimize pattern filling by limiting small calls to memcpy.
Date: Thu, 2 Feb 2012 09:48:39 +0100	[thread overview]
Message-ID: <4F2A4DE7.7020409@fusionio.com> (raw)
In-Reply-To: <CAAUT-yOCgVD61WtQB4CtY86zzYFCBfN4G=F=QCd4kvqFb4zx+Q@mail.gmail.com>

On 02/02/2012 02:39 AM, Steven Lang wrote:
> In looking at profiling the speed of fill_pattern(), it calls memcpy()
> for the fill pattern repeatedly for multibyte patterns.  So for a 4
> byte pattern with 8k IO, it calls memcpy() 2048 times.
> 
> Since there is already 512 bytes reserved for the pattern, I figured a
> simple solution was to use it.  This patch replicates short patterns
> so they can be more efficiently copied.  (Single byte patterns are
> left alone since they can make use of the much more efficient memset()
> call.)
> 
> The result is a 10x performance improvement on pattern filling.  (With
> this patch, it's still 3x slower than when it re-uses the already
> filled pattern.)
> 
> ---
>  options.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/options.c b/options.c
> index f9bd1a4..b6989d4 100644
> --- a/options.c
> +++ b/options.c
> @@ -689,6 +689,10 @@ static int str_verify_pattern_cb(void *data,
> const char *input)
>  			}
>  		}
>  	}
> +	while (i > 1 && i * 2 <= MAX_PATTERN_SIZE) {
> +		memcpy(&td->o.verify_pattern[i], &td->o.verify_pattern[0], i);
> +		i *= 2;
> +	}
>  	td->o.verify_pattern_bytes = i;
>  	/*
>  	 * VERIFY_META could already be set

Looks like you are missing the interesting part of this patch :-)
But the idea definitely sounds good.

-- 
Jens Axboe


  reply	other threads:[~2012-02-02  8:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-02  1:39 [PATCH] Optimize pattern filling by limiting small calls to memcpy Steven Lang
2012-02-02  8:48 ` Jens Axboe [this message]
2012-02-02 19:11   ` Steven Lang
2012-02-02 19:20     ` Jens Axboe

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=4F2A4DE7.7020409@fusionio.com \
    --to=jaxboe@fusionio.com \
    --cc=fio@vger.kernel.org \
    --cc=tirea@google.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