N-Queens Browser Benchmark

I was playing around with solving the N-Queens Puzzle in JavaScript and thought it would do nicely as a browser benchmark.  I’m not using much in the way of heuristics or optimizations in this version.  In summary, Google Chrome 4.0 is fast.


Here’s the code I used to run the test: n-queens at ApeJet.org.  I ran the test on my Windows 7 box, while only running the one browser at a time.  For each browser, I used the following values of N: 17, 18, 20, 24.  I ran each value three times and then averaged.  From these averages, I calculated the multiplier by dividing by Chrome’s average time.  Then, I averaged the four multipliers (one for each N) to create the graph.

I wanted to show Internet Explorer 8, but was only able to collect accurate times for N=17.  For the other three tests, it shows the “Stop running this script?” prompt which pauses execution.  On the N=17 runs, it was nearly the same speed as Opera 10.10.  Both of them were more than 10 times slower than Chrome, which is pretty bad.  IE 9 should be faster than 8, but it’s not out yet, so I can’t test it.   Opera 10.5 is available as a pre-alpha and is supposed to be faster, but I haven’t tried it out yet.

I was disappointed to see that Firefox 3.6 was about 5 times slower than Chrome.  My code may be tripping up the JIT compiler.  I may try to tweak it to see if I can get it to run better.  As it is, I may need to switch my default browser to Chrome (thanks to Xmarks for synchronizing my bookmarks).

Leave a Reply