From: Gerd Hoffmann <kraxel@redhat.com>
To: Peter Lieven <pl@kamp.de>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/2] io/buffer: avoid memmove at each qio_buffer_advance
Date: Tue, 03 Nov 2015 11:52:49 +0100 [thread overview]
Message-ID: <1446547969.4693.12.camel@redhat.com> (raw)
In-Reply-To: <1446541276-32467-3-git-send-email-pl@kamp.de>
> diff --git a/include/io/buffer.h b/include/io/buffer.h
> index f63869e..43688cc 100644
> --- a/include/io/buffer.h
> +++ b/include/io/buffer.h
> @@ -39,6 +39,8 @@ struct QIOBuffer {
> size_t offset;
> uint64_t avg_size;
> uint8_t *buffer;
> + size_t base_offs;
> + uint8_t *base_ptr;
Why a separate base_ptr?
While being at it I'd much prefer to replace offset with start & end.
The buffer content is buffer[start] ... buffer[end-1] then.
We can allow the buffer to wrap around, i.e. end < start. Buffer
content is buf[start] ... buffer[size-1] and buffer[0] .. buffer[end-1]
then. Makes the buffer management a bit more complicated, but we never
have to memmove then (except when changing buffer size) and the
WASTED_SIZE logic isn't needed too ...
cheers,
Gerd
next prev parent reply other threads:[~2015-11-03 10:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-03 9:01 [Qemu-devel] [PATCH 0/2] vnc buffer enhancements for 2.5 Peter Lieven
2015-11-03 9:01 ` [Qemu-devel] [PATCH 1/2] io/buffer: allow a buffer to shrink gracefully Peter Lieven
2015-11-03 10:40 ` Gerd Hoffmann
2015-11-05 22:09 ` Peter Lieven
2015-11-03 9:01 ` [Qemu-devel] [PATCH 2/2] io/buffer: avoid memmove at each qio_buffer_advance Peter Lieven
2015-11-03 10:52 ` Gerd Hoffmann [this message]
2015-11-03 12:20 ` Peter Lieven
2015-11-03 11:17 ` Markus Armbruster
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=1446547969.4693.12.camel@redhat.com \
--to=kraxel@redhat.com \
--cc=pl@kamp.de \
--cc=qemu-devel@nongnu.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.