all devices regression report - 2017-11-02-15:11:33 - 31cb4cf7aa88784219f6fc2be362a66df2f67289
| Newsgroups | gmane.comp.printing.ghostscript.regression |
|---|---|
| Message-ID | <20171102221133.5AC2120408B4@i7> |
Differences in all devices errors using gs/examples files Previous Revision: de651aaa531a7eb6fa99c1ef97682ebe22a3cda7 Current Revision: 31cb4cf7aa88784219f6fc2be362a66df2f67289 commit 31cb4cf7aa88784219f6fc2be362a66df2f67289 Author: Robin Watts <[email protected]> AuthorDate: Fri Oct 27 20:24:32 2017 +0100 CommitDate: Wed Nov 1 13:38:16 2017 +0000 Tweak cmap functions for speed. In looking at the Advertising-PowerPoint-A4.pdf file, I noted that cmap_gray_direct and cmap_gray_halftoned were taking a noticable amount of time. This commit attempts to alleviate that. Various observations: 1) Avoid unnecessary loop in cmap_gray_halftoned (and similar functions). In some of the code, we do: for (i = 0; i < n; i++) if (i == k) do_something_with(i) why not just use: if (k < n) do_something_with(k) 2) Typically functions like cmap_gray_direct do a load of work, culminating in trying to encode a color value. If that encoding fails, it would fallback to trying to use a cmap_gray_halftoned, which would do all the work a second time. Tweak the code to avoid the call, and hence the repetition. The downside to this is that the work is typically of the form: for (i = 0; i < n; i++) cv[i] = frac2cv(some_calculation_involving(cm_comps[i])); and in order to be able to avoid the call to cmap_gray_halftoned, we need to make it: for (i = 0; i < n; i++) { cm_comps[i] = some_calculation_involving(cm_comps[i]); cv[i] = frac2cv(cm_comps[i]); } i.e. we have to do more stores than before. This can hurt us in some cases, but it seems like a worthwhile win, especially in light of 3). 3) A lot of the work in these functions involves mapping colors through the effective_transfer functions. This happens in code of the form: for (i = 0; i < n; i++) { cm_comps[i] = gx_map_color_frac(pgs, cm_comps[i], effective_transfer[i]); } If effective_transfer[i] is identity (as it almost always is), then this whole loop is a nop. We make some steps to optimise for this case by having the gx_map_color_frac macro check for effective_transfer[i] being gs_identity_transfer before calling it, but this doesn't help us avoid the loop/load/store. We therefore extend pgs with a count of the number of 'effective_transfer's that are non identity (essentially a flag that enables us to know if we can skip this loop or not), and use that to optimise our work. base/gsht.c base/gxcmap.c base/gxgstate.h new errors: errors that went away: errors that are not whitelisted: === ghostpdl/examples/transparency_example.ps === cp50 === === ghostpdl/examples/transparency_example.ps === psdrgb ===