Subject: Re: [PATCH 5/5] oidtree: a crit-bit tree for odb_loose_cache

From: Junio C Hamano <[email-masked]>
Date: Tue, 29 Jun 2021 07:42:03 -0700

Eric Wong <[email-masked]> writes:

> This saves 8K per `struct object_directory', meaning it saves
> around 800MB in my case involving 100K alternates (half or more
> of those alternates are unlikely to hold loose objects).
>
> This is implemented in two parts: a generic, allocation-free
> `cbtree' and the `oidtree' wrapper on top of it.  The latter
> provides allocation using alloc_state as a memory pool to
> improve locality and reduce free(3) overhead.

This seems to break CI test, with "fatal: not a hexadecimal oid",
perhaps because there is hardcoded 40 here?

> index 0000000000..bb4229210c
> --- /dev/null
> +++ b/t/t0069-oidtree.sh
> @@ -0,0 +1,52 @@
> +#!/bin/sh
> +
> +test_description='basic tests for the oidtree implementation'
> +. ./test-lib.sh
> +
> +echoid () {
> +	prefix="${1:+$1 }"
> +	shift
> +	while test $# -gt 0
> +	do
> +		echo "$1"
> +		shift
> +	done | awk -v prefix="$prefix" '{
> +		printf("%s%s", prefix, $0);
> +		need = 40 - length($0);
> +		for (i = 0; i < need; i++)
> +			printf("0");
> +		printf "\n";
> +	}'