geotiffjs / geotiff.js

geotiff.js is a small library to parse TIFF files for visualization or analysis. It is written in pure JavaScript, and is usable in both the browser and node.js applications.
https://geotiffjs.github.io/
MIT License
859 stars 179 forks source link

Decoder performance #364

Open pearcetm opened 1 year ago

pearcetm commented 1 year ago

I've been trying to track down some decoder performance bottlenecks related to an OpenSeadragon tilesource plugin I've created that uses geotiff.js to extract zoomable TIFF data. Specifically, files with YCbCr were taking much more decoding time than RGB encoded files, but the conversion itself didn't seem to account for the difference.

I noticed that how async methods in were handled (await vs promises) was different in these cases, so I forked the repo to try to adjust this behavior and test performance... however, strangely, simply building a local copy of the main branch and including it in the demo/test page caused a substantial decrease in performance vs a script (same version) loaded from a CDN. The difference is between ~40ms per tile to decode a bunch of concurrent 256X256 tile requests using the CDN version, vs 80-120ms+ with the locally-built version. This seems very strange to me... any hints/thoughts would be most welcome.