How do you performance test JavaScript code? -
cpu cycles, memory usage, execution time, etc.?
added: there quantitative way of testing performance in javascript besides perception of how fast code runs?
profilers way numbers, in experience, perceived performance matters user/client. example, had project ext accordion expanded show data , few nested ext grids. rendering pretty fast, no single operation took long time, there lot of information being rendered @ once, felt slow user.
we 'fixed' this, not switching faster component, or optimizing method, rendering data first, rendering grids settimeout. so, information appeared first, grids pop place second later. overall, took more processing time way, user, perceived performance improved.
edit: answer 7 years old. these days, chrome profiler , other tools universally available , easy use, console.time()
, console.profile()
, , performance.now()
. chrome gives timeline view can show killing frame rate, user might waiting, etc.
finding documentation these tools easy, don't need answer that. 7 years later, i'll still repeat advice of original answer , point out can have slow code run forever user won't notice it, , pretty fast code running do, , complain pretty fast code not being fast enough. or request server api took 220ms. or else that. point remains if take profiler out , go looking work do, find it, may not work users need.
Comments
Post a Comment