commit c060419155a593f55d2dac4aa7f4409fc590458f from: Omar Polo via: Thomas Adam date: Sat Jul 29 19:05:01 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 - fff2d77497adc7541625b5e877348ffa08e79583 commit + c060419155a593f55d2dac4aa7f4409fc590458f blob - 3f839c82af01a867deb0873649f2be20b393bc62 blob + 1e15dde9d8968aefdeb7e7e8b17ed022ff243ff8 --- lib/deltify.c +++ lib/deltify.c @@ -141,18 +141,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. @@ -205,18 +205,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.