How do you performance test JavaScript code?

前端 未结 22 1137
难免孤独
难免孤独 2020-11-22 04:18

CPU Cycles, Memory Usage, Execution Time, etc.?

Added: Is there a quantitative way of testing performance in JavaScript besides just perception of how fast the code

22条回答
  •  臣服心动
    2020-11-22 04:43

    JSLitmus is a lightweight tool for creating ad-hoc JavaScript benchmark tests

    Let examine the performance between function expression and function constructor:

    
    
    

    What I did above is create a function expression and function constructor performing same operation. The result is as follows:

    FireFox Performance Result

    FireFox Performance Result

    IE Performance Result

    IE Performance Result

提交回复
热议问题