Async Clipboard: Use faster image/png encoding.
Before this CL, navigator.clipboard.read image/png encoding used fZLibLevel = 6. Use fZLibLevel = 1 instead of the default fZLibLevel = 6. fZLibLevel = 6 is slower, and inconsistent with DataTransfer[1], which already uses fZLibLevel = 1. When testing using https://www.photopea.com/clipboard_img.html , which provides a 8000x4000 px bitmap of random pixels, navigator.clipboard.read took: * 4.10 (4.07 to 4.13) seconds over 3 trials with fZLibLevel = 6 * 3.98 (3.95 to 4.00) seconds over 3 trials with fZLibLevel = 1 * 1.53 (1.50 to 1.56) seconds over 3 trials with fZLibLevel = 0 Switching from fZLibLevel 6 to fZLibLevel 1 should enable a 3% speed-up in Async Clipboard performance, and not cause any change in behavior for DataTransfer (which would occur with fZLibLevel 0). The trade off is that this may cause encoded image/png images to be slightly larger, but this should be acceptable for clipboard content. [1]: https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/clipboard/data_object_item.cc?l=141 Bug: 1004867 Change-Id: Ie557b211bbe70e19009c5d67fca310cc970101cc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1824063 Commit-Queue: Victor Costan <pwnall@chromium.org> Reviewed-by:Victor Costan <pwnall@chromium.org> Cr-Commit-Position: refs/heads/master@{#699650}
Showing
Please register or sign in to comment