TheDiamondProject / Graphite

MIT License
16 stars 6 forks source link

Performance improvements #23

Closed andrews05 closed 3 years ago

andrews05 commented 3 years ago

This PR makes a couple of changes to improve performance:

  1. Changes packbits runs to a double loop with push_back instead of insert.
  2. Changes clut reader to index the entries by their value when the device flag is not set. This allows instant lookups via get rather than having to search for the value. Note this ensures safe values by modding them by the count, which in theory could give incorrect results in some cases, but ImagickMagick appears to be doing it the same way (as best I can tell) so I figure it's okay.

(This is primarily helpful for me when running debug builds, which can be pretty slow at decoding PICTs. 1. may not actually make any difference in production.)