Skip to content

Commit a02c490

Browse files
authored
Fix cache thrashing for large images (#106)
cfImageCrop constructs a new image with the default tile cache size. This create disastrously bad performance on large images. For example, calling imagetoraster on an ARCHE sized page (36x48 inches, 21600 pixels wide) takes over 300s before this patch, all of which is in libc_read and libc_write. The cache size is 10 tiles, but the required cache size is actually about 900-1000 tiles. With the patch, the temp image correctly inherits a bigger cache (that was sized using the image width), and that same invocation costs 40s.
1 parent badb59e commit a02c490

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cupsfilters/image.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ cfImageCrop(cf_image_t* img,
653653
cf_ib_t *pixels = (cf_ib_t*)malloc(img->xsize * cfImageGetDepth(img));
654654

655655
temp->cachefile = -1;
656-
temp->max_ics = CF_TILE_MINIMUM;
656+
temp->max_ics = img->max_ics;
657657
temp->colorspace = img->colorspace;
658658
temp->xppi = img->xppi;
659659
temp->yppi = img->yppi;

0 commit comments

Comments
 (0)