Skip to content

Instantly share code, notes, and snippets.

@astojilj
Created August 27, 2019 12:30
Show Gist options
  • Save astojilj/96915e2b9931ad5384335847b6a4e11e to your computer and use it in GitHub Desktop.
Save astojilj/96915e2b9931ad5384335847b6a4e11e to your computer and use it in GitHub Desktop.
new DEMData and getImageData measurement patch
diff --git a/src/source/raster_dem_tile_source.js b/src/source/raster_dem_tile_source.js
index 1937a103d..e7c6cafc2 100644
--- a/src/source/raster_dem_tile_source.js
+++ b/src/source/raster_dem_tile_source.js
@@ -55,7 +55,10 @@ class RasterDEMTileSource extends RasterTileSource implements Source {
delete (img: any).cacheControl;
delete (img: any).expires;
+ const t = performance.now();
const rawImageData = browser.getImageData(img);
+ const t1 = performance.now();
+ console.log("browser.getImageData: " + (t1 - t) + "ms");
const params = {
uid: tile.uid,
coord: tile.tileID,
diff --git a/src/source/raster_dem_tile_worker_source.js b/src/source/raster_dem_tile_worker_source.js
index 41e10139b..7c52e677a 100644
--- a/src/source/raster_dem_tile_worker_source.js
+++ b/src/source/raster_dem_tile_worker_source.js
@@ -19,7 +19,10 @@ class RasterDEMTileWorkerSource {
loadTile(params: WorkerDEMTileParameters, callback: WorkerDEMTileCallback) {
const {uid, encoding, rawImageData} = params;
+ const t = performance.now();
const dem = new DEMData(uid, rawImageData, encoding);
+ const t1 = performance.now();
+ console.log("new DEMData: " + (t1 - t) + "ms");
this.loaded = this.loaded || {};
this.loaded[uid] = dem;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment