1

Is there any possibility of analyzing performance of javascript on mobile. Like I have a situation where say a list is rendered quite slowly on mobile (like 3-4 minutes).

Initially i thought its because of the data model and kind of query i am using is causing the delay, but when i took database traces all the query execution is really fast.

I also got hold of n/w trace of attached device (which is simulator in my case) and could see all the data being buffered in under 3 secs. So the only culprit what i anticipate is the JS running behind to render all the data. But i dont know how to trace or do performance analysis of JS on mobile. Any idea??

1 Answer 1

1

I'm not sure if this is what you're looking for, (your question somewhat confuses me) but here's how to test how long a piece of code takes in JavaScript:

var start = new Date().getTime(); //milliseconds // your section of code // ... var elapsed = new Date().getTime() - start; 

You could do that to test specific sections of your code for execution length.

If you had <div id="timetaken"></div> somewhere in your HTML, you could add

document.getElementById('timetaken').innerHTML="Time taken: " + elapsed; 

And then when your code completes it would display how long that bit of code took to complete in your HTML so that you can see it on a mobile device.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.