Message ID | pull.1039.v2.git.1631696964072.gitgitgadget@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | b4797add3a2fa50439251c98a819e89def9fe250 |
Headers | show |
Series | [v2] pack-revindex.h: correct the time complexity descriptions | expand |
On 15/09/21 16.09, Kyle Zhao via GitGitGadget wrote: > From: kylezhao <kylezhao@tencent.com> > > Time complexities for pack_pos_to_midx and midx_to_pack_pos are swapped, > correct it. > > Signed-off-by: kylezhao <kylezhao@tencent.com> > --- <snip>... > pack-revindex.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/pack-revindex.h b/pack-revindex.h > index 479b8f2f9c9..74f4eae668d 100644 > --- a/pack-revindex.h > +++ b/pack-revindex.h > @@ -109,7 +109,7 @@ off_t pack_pos_to_offset(struct packed_git *p, uint32_t pos); > * If the reverse index has not yet been loaded, or the position is out of > * bounds, this function aborts. > * > - * This function runs in time O(log N) with the number of objects in the MIDX. > + * This function runs in constant time. > */ > uint32_t pack_pos_to_midx(struct multi_pack_index *m, uint32_t pos); > > @@ -120,7 +120,7 @@ uint32_t pack_pos_to_midx(struct multi_pack_index *m, uint32_t pos); > * If the reverse index has not yet been loaded, or the position is out of > * bounds, this function aborts. > * > - * This function runs in constant time. > + * This function runs in time O(log N) with the number of objects in the MIDX. > */ > int midx_to_pack_pos(struct multi_pack_index *midx, uint32_t at, uint32_t *pos); > > > base-commit: 8b7c11b8668b4e774f81a9f0b4c30144b818f1d1 > OK. Reviewed-by: Bagas Sanjaya <bagasdotme@gmail.com>
On Wed, Sep 15, 2021 at 09:09:23AM +0000, Kyle Zhao via GitGitGadget wrote: > From: kylezhao <kylezhao@tencent.com> > > Time complexities for pack_pos_to_midx and midx_to_pack_pos are swapped, > correct it. Great eyes! Thanks for noticing and fixing. I took a look through the other three functions which convert between pack offset, pack position, and index position, and those had the correct runtime noted. But these two were swapped, and are now correct after your patch. Thanks again. Reviewed-by: Taylor Blau <me@ttaylorr.com> Thanks, Taylor
Taylor Blau <me@ttaylorr.com> writes: > But these two were swapped, and are now correct after your patch. Thanks > again. > > Reviewed-by: Taylor Blau <me@ttaylorr.com> > > Thanks, > Taylor Yup, both are from f894081d (pack-revindex: read multi-pack reverse indexes, 2021-03-30) and a "reviewed-by:" from the person who wrote it certainly is appreciated :-). Thanks, both.
diff --git a/pack-revindex.h b/pack-revindex.h index 479b8f2f9c9..74f4eae668d 100644 --- a/pack-revindex.h +++ b/pack-revindex.h @@ -109,7 +109,7 @@ off_t pack_pos_to_offset(struct packed_git *p, uint32_t pos); * If the reverse index has not yet been loaded, or the position is out of * bounds, this function aborts. * - * This function runs in time O(log N) with the number of objects in the MIDX. + * This function runs in constant time. */ uint32_t pack_pos_to_midx(struct multi_pack_index *m, uint32_t pos); @@ -120,7 +120,7 @@ uint32_t pack_pos_to_midx(struct multi_pack_index *m, uint32_t pos); * If the reverse index has not yet been loaded, or the position is out of * bounds, this function aborts. * - * This function runs in constant time. + * This function runs in time O(log N) with the number of objects in the MIDX. */ int midx_to_pack_pos(struct multi_pack_index *midx, uint32_t at, uint32_t *pos);