Re: [PATCH 4/4] pack-revindex: radix-sort the revindex

2013-07-10 Thread Jeff King
On Mon, Jul 08, 2013 at 01:50:41PM -0700, Brandon Casey wrote: > > +static void sort_revindex(struct revindex_entry *entries, int n, off_t max) > > If 'n' is the number of objects in the pack, shouldn't it be unsigned? Yes. I inherited that bug from the rest of the revindex code. > The data typ

Re: [PATCH 4/4] pack-revindex: radix-sort the revindex

2013-07-10 Thread Jeff King
On Mon, Jul 08, 2013 at 02:35:10PM -0700, Brandon Casey wrote: > > If 'n' is the number of objects in the pack, shouldn't it be unsigned? > > > > The data type for struct packed_git.num_objects is uint32_t. Looks > > like create_pack_revindex uses the wrong datatype when it captures > > num_objec

Re: [PATCH 4/4] pack-revindex: radix-sort the revindex

2013-07-08 Thread Brandon Casey
On Mon, Jul 8, 2013 at 1:50 PM, Brandon Casey wrote: > On Sun, Jul 7, 2013 at 3:14 AM, Jeff King wrote: >> diff --git a/pack-revindex.c b/pack-revindex.c >> index 77a0465..d2adf36 100644 >> --- a/pack-revindex.c >> +++ b/pack-revindex.c >> @@ -59,11 +59,78 @@ static int cmp_offset(const void *a_

Re: [PATCH 4/4] pack-revindex: radix-sort the revindex

2013-07-08 Thread Brandon Casey
On Sun, Jul 7, 2013 at 3:14 AM, Jeff King wrote: > The pack revindex stores the offsets of the objects in the > pack in sorted order, allowing us to easily find the on-disk > size of each object. To compute it, we populate an array > with the offsets from the sha1-sorted idx file, and then use > q

Re: [PATCH 4/4] pack-revindex: radix-sort the revindex

2013-07-08 Thread Shawn Pearce
On Mon, Jul 8, 2013 at 12:57 AM, Jeff King wrote: > On Sun, Jul 07, 2013 at 04:52:23PM -0700, Shawn O. Pearce wrote: > >> On Sun, Jul 7, 2013 at 3:14 AM, Jeff King wrote: >> > The pack revindex stores the offsets of the objects in the >> > pack in sorted order, allowing us to easily find the on-d

Re: [PATCH 4/4] pack-revindex: radix-sort the revindex

2013-07-08 Thread Jeff King
On Sun, Jul 07, 2013 at 04:52:23PM -0700, Shawn O. Pearce wrote: > On Sun, Jul 7, 2013 at 3:14 AM, Jeff King wrote: > > The pack revindex stores the offsets of the objects in the > > pack in sorted order, allowing us to easily find the on-disk > > size of each object. To compute it, we populate a

Re: [PATCH 4/4] pack-revindex: radix-sort the revindex

2013-07-07 Thread Shawn Pearce
On Sun, Jul 7, 2013 at 3:14 AM, Jeff King wrote: > The pack revindex stores the offsets of the objects in the > pack in sorted order, allowing us to easily find the on-disk > size of each object. To compute it, we populate an array > with the offsets from the sha1-sorted idx file, and then use > q

[PATCH 4/4] pack-revindex: radix-sort the revindex

2013-07-07 Thread Jeff King
The pack revindex stores the offsets of the objects in the pack in sorted order, allowing us to easily find the on-disk size of each object. To compute it, we populate an array with the offsets from the sha1-sorted idx file, and then use qsort to order it by offsets. That does O(n log n) offset co