Here is a very useful tool which allows you to create nice benchmark tests for your JavaScript code. You can check all the details on their home page:

JSLitmus