Lionel Koh
Lionel Koh

Reputation: 199

Is there a way to measure javascript cpu processing lags

I am having a problem trying to articulate what I am trying to measure but I would do my best in hope for some assistance.

If I would to bind alot of functions to the .resize() event or to add massive amount of listeners, somehow I believe that the cpu processing would increase and that at a certain point the application would lag. (Do correct me if I am wrong).

I am attributing this to the CPU usage(Please correct the term if it is wrong).

Is there anyway to measure this lag(cpu usage).

Thanks

Upvotes: 3

Views: 205

Answers (2)

Dave
Dave

Reputation: 2576

In Google Chrome's Developer Tools there are timelines for recording memory usage and CPU profiling. Lots of good examples on the web for how to use these tools.

Upvotes: 1

TGH
TGH

Reputation: 39248

You can monitor your browser in TaskManager if you're using Windows. JavaScript executes in the browser, so it will be part of the footprint of the browser itself. Some times different browsers will run the same JavaScript with different performance. It just depend how optimized the browser is for that particular code block. Most browsers will also give you profiling tools that will enable you to pinpoint specific JavaScript functions that are slow. (ex IE dev tools). This is necessary to take a more targeted approach when troubleshooting your performance issues.

Upvotes: 1

Related Questions