From: Junio C Hamano <junkio@cox.net>
To: Nicolas Pitre <nico@cam.org>
Cc: Geert Bosch <bosch@adacore.com>, Git Mailing List <git@vger.kernel.org>
Subject: Re: RFC: New diff-delta.c implementation
Date: Sat, 22 Apr 2006 10:29:55 -0700 [thread overview]
Message-ID: <7vslo5ikmk.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0604220835190.2215@localhost.localdomain> (Nicolas Pitre's message of "Sat, 22 Apr 2006 08:45:07 -0400 (EDT)")
Nicolas Pitre <nico@cam.org> writes:
> Well, actually I was measuring a 10% speed improvement with a quick and
> naive (not memory efficient) approach for pack-objects with the current
> algorithm.
>...
> The idea to avoid memory pressure is to reverse the window processing
> such that the object to delta against is constant for the entire window
> instead of the current logic where the target object is constant. This
> way there would be only one index in memory at all time.
Your are right. The first led to the latter unexplored idea.
I expect to be offline most of the day today, and have other
things I can work on for the next few days anyway, so if you or
somebody else have an inclination and energy to reverse the
delta window, I would appreciate that.
Maybe the calling convention of diff-delta.c would become
something like this?
struct delta_index; /* opaque to the caller; implementation
* defines what's in it.
*/
/* returns a newly allocated struct delta_index.
* input "buf" pointer can be stored in the struct, but "buf"
* does not belong to diff-delta module (i.e. borrowed reference).
*/
struct delta_index *delta_index(
void *buf, /* input: from buffer */
unsigned long size, /* input: from size */
);
/* ... so free the structure and its internal data, but
* do not free the borrowed reference!
*/
void free_delta_index(struct delta_index *);
/* Take "from", an already preprocessed delta_index for the
* traditional from_buffer/from_size, and to_buf/to_size, and
* produce delta in newly allocated buffer (caller should
* free() when it is done), and return the result size in
* *delta_size. Stop early if the result would exceed max_size.
*/
void *diff_delta(
struct delta_index *from, /* input: prepared by delta_index() */
void *to_buf, /* input: destination buffer */
unsigned long to_size, /* input: destination size */
unsigned long *delta_size, /* output: result size */
unsigned long max_size /* input: do not waste cycles if
you cannot generate result
smaller than this */
);
and the calling convention would be:
struct unpacked *s, *d;
unsigned long max_size;
/* precompute the index */
struct delta_index *src = delta_index(s->data, s->entry->size);
/* do the delta */
void *delta_buf = diff_delta(src, d->data, d->entry->size,
&sz, max_size);
/* do useful thing here on delta_buf and sz */
free(delta_buf);
/* the caller can reuse *src with other *d,
* but when it is done...
*/
free_delta_index(src);
next prev parent reply other threads:[~2006-04-22 17:30 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-21 21:16 RFC: New diff-delta.c implementation Geert Bosch
2006-04-22 3:19 ` Nicolas Pitre
2006-04-22 11:04 ` Geert Bosch
2006-04-22 11:13 ` Junio C Hamano
2006-04-22 12:35 ` Geert Bosch
2006-04-22 12:51 ` Nicolas Pitre
2006-04-22 13:39 ` Geert Bosch
2006-04-22 17:03 ` Junio C Hamano
2006-04-22 17:28 ` Geert Bosch
2006-04-22 17:57 ` Junio C Hamano
2006-04-22 12:45 ` Nicolas Pitre
2006-04-22 14:17 ` Geert Bosch
2006-04-22 17:29 ` Junio C Hamano [this message]
2006-04-22 19:58 ` Nicolas Pitre
2006-04-22 5:21 ` Davide Libenzi
2006-04-22 9:12 ` Geert Bosch
2006-04-22 12:36 ` Rene Scharfe
2006-04-24 2:57 ` Geert Bosch
2006-04-24 5:27 ` Nicolas Pitre
2006-04-24 15:19 ` Geert Bosch
2006-04-24 15:57 ` Nicolas Pitre
2006-04-24 16:31 ` Geert Bosch
2006-04-24 18:24 ` Geert Bosch
2006-04-24 18:27 ` Geert Bosch
2006-04-24 19:21 ` Rutger Nijlunsing
2006-04-24 20:37 ` Petr Baudis
2006-04-24 18:44 ` Geert Bosch
2006-04-25 18:22 ` Rene Scharfe
2006-04-22 20:36 ` Davide Libenzi
2006-04-23 2:31 ` Geert Bosch
2006-04-24 19:10 ` Davide Libenzi
2006-04-24 19:23 ` Geert Bosch
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=7vslo5ikmk.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=bosch@adacore.com \
--cc=git@vger.kernel.org \
--cc=nico@cam.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.