commit 0f2e686eec562e28977521d25101acfa4396b47a from: Omar Polo date: Fri Jul 28 19:10:27 2023 UTC bump the deltify table resize step By incrementing the resize step from 64 to 256 deltifying takes less time on modestly sized files; the resize is still a small number instead of a fraction of the current table size (which would be more usual for a hash table) since this code is also used in gotd. ok stsp commit - 4ada367c22bf146c8150cb54c980abc40c6e4465 commit + 0f2e686eec562e28977521d25101acfa4396b47a blob - 904fe2806d161dfaee79db5f0f3c73e691d3f4dc blob + 99b5d418b8cec83d130d52be4e5022d0310f8c31 --- lib/deltify.c +++ lib/deltify.c @@ -140,18 +140,18 @@ addblk(struct got_delta_table *dt, FILE *f, off_t file dt->blocks[i].offset = offset; dt->blocks[i].hash = h; dt->nblocks++; - if (dt->nalloc < dt->nblocks + 64) { + if (dt->nalloc < dt->nblocks + 256) { struct got_delta_block *db; size_t old_size = dt->nalloc; db = dt->blocks; - dt->blocks = calloc(dt->nalloc + 64, + dt->blocks = calloc(dt->nalloc + 256, sizeof(struct got_delta_block)); if (dt->blocks == NULL) { err = got_error_from_errno("calloc"); dt->blocks = db; return err; } - dt->nalloc += 64; + dt->nalloc += 256; /* * Recompute all block positions. Hash-based indices of blocks * in the array depend on the allocated length of the array. @@ -204,18 +204,18 @@ addblk_mem(struct got_delta_table *dt, uint8_t *data, dt->blocks[i].offset = offset; dt->blocks[i].hash = h; dt->nblocks++; - if (dt->nalloc < dt->nblocks + 64) { + if (dt->nalloc < dt->nblocks + 256) { struct got_delta_block *db; size_t old_size = dt->nalloc; db = dt->blocks; - dt->blocks = calloc(dt->nalloc + 64, + dt->blocks = calloc(dt->nalloc + 256, sizeof(struct got_delta_block)); if (dt->blocks == NULL) { err = got_error_from_errno("calloc"); dt->blocks = db; return err; } - dt->nalloc += 64; + dt->nalloc += 256; /* * Recompute all block positions. Hash-based indices of blocks * in the array depend on the allocated length of the array.