I am using OpenLayers version 3 (answers with ver 2 are also OK) and want to measure how long it takes to render the vector layer. So, I have a vector layer with features:

var vectorLayer = new ol.layer.Vector({
    source: vectorSource

And my map object:

var map = new ol.Map({
        renderer: 'canvas',
        target: document.getElementById('map'),
        view: new ol.View({
            center: [550000, 6520000],
            resolution: 500,
            minZoom: 1,
            maxZoom: 10,
            zoom: 1,
            resolutions: [500.0, 250.0, 125.0, 62.5, 31.25, 15.625, 7.8125, 3.90625, 1.953125, 0.9765625, 0.48828125],
            projection: projection

I want to measure how long it takes to render all features from the layer. If I do like this

 var start=performance.now();
 var time=performance.now()-start;

then I see time in console much much earlier than points on map. I want to see the time right after all points are rendered. How can I do that?

1 Answer 1


You could listen to the postrender event which is triggered after a frame is rendered.

map.on('postrender', function(){
  console.log('frame rendered');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.