tangrams / tangram

WebGL map rendering engine for creative cartography
https://tangram.city
MIT License
2.21k stars 290 forks source link

Tile Rendering Time #750

Closed sheikh-iffi closed 4 years ago

sheikh-iffi commented 4 years ago

Hi guys,

I am trying to calculate tile render time. Is there a way to do that? I wanna check the performance difference of using single tile source vs multi-tile sources.

bcamper commented 4 years ago

Hi @sheikh-iffi -- there's an internal/development method for measuring this:

scene.debug.timeRebuild(numRebuilds)

Try calling it in the console, and it will rebuild the scene numRebuilds times, and give you average, min, and max times to rebuild the whole scene from scratch. Because of variability, I recommend using a number like 25 to get a good average. For instance, calling it as such should produce a message like this in the console:

Tangram v0.20.1 [info]: Profiled rebuild 25 times: 167 avg (126 min, 202 max)

Hope that helps!

bcamper commented 4 years ago

I should note, the scene object here is a shortcut for the scene property on Tangram Leaflet layer, e.g. in a case like this, it could be accessed via layer.scene: https://github.com/tangrams/tangram/blob/master/demos/main.js#L22-L34.