git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Rutger Nijlunsing <git@wingding.demon.nl>, git@vger.kernel.org
Subject: Object hash (was: Re: [ANNOUNCE] git-rev-size: calculate sizes of repository)
Date: Sun, 20 Aug 2006 18:37:33 +0200	[thread overview]
Message-ID: <200608201837.33577.Josef.Weidendorfer@gmx.de> (raw)
In-Reply-To: <Pine.LNX.4.63.0608201805070.28360@wbgn013.biozentrum.uni-wuerzburg.de>

On Sunday 20 August 2006 18:09, Johannes Schindelin wrote:
Hi,

> Most notably, it adds an object hash map structure to the library.

Aside from the given command of this thread, this is interesting
(even more interesting would be a persistent cache for arbitrary object data).
As this could be used in other contexts, some general comments:

> +static unsigned int hash_index(struct hash_map *hash, const char *sha1)
> +{
> +	unsigned int index = *(unsigned int *)sha1;

If you have the same SHA1, stored at different addresses, you get different
indexes for the same SHA1. Index probably should be calculated from the
SHA1 string.

> +void hash_put(struct hash_map *hash, struct object *obj)
> +{
> +	if (++hash->nr > hash->alloc / 2)
> +		grow_hash(hash);

If you insert the same object multiple times, hash->nr will get too big.

Josef

  reply	other threads:[~2006-08-20 16:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-20 10:54 [ANNOUNCE] git-rev-size: calculate sizes of repository Rutger Nijlunsing
2006-08-20 13:20 ` Johannes Schindelin
2006-08-20 15:24   ` Rutger Nijlunsing
2006-08-20 16:09     ` Johannes Schindelin
2006-08-20 16:37       ` Josef Weidendorfer [this message]
2006-08-20 16:51         ` Object hash (was: Re: [ANNOUNCE] git-rev-size: calculate sizes of repository) Johannes Schindelin
2006-08-20 17:40           ` Rutger Nijlunsing
2006-08-20 18:41           ` Josef Weidendorfer
2006-08-20 18:47             ` Johannes Schindelin
2006-08-20 17:24       ` [ANNOUNCE] git-rev-size: calculate sizes of repository Rutger Nijlunsing
2006-08-20 18:44         ` Johannes Schindelin
2006-08-20 21:38       ` Junio C Hamano
2006-08-20 23:36         ` Johannes Schindelin

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=200608201837.33577.Josef.Weidendorfer@gmx.de \
    --to=josef.weidendorfer@gmx.de \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=git@wingding.demon.nl \
    /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;
as well as URLs for NNTP newsgroup(s).