Donate Javascript Clipper Project
This page presents the results of performance tests in various browsers. The performance was measured using benchmark feature of the Javascript Clipper Main Demo.
The benchmark feature of the Javascript Clipper Main Demo has two parts. One measures performance using low coordinate values, and we call it Normal Benchmark. The other one measures performance using higher coordinate values, and we call it Big Integer Benchmark. (For some reason Clipper uses big integers when FindSegment() function calls SlopesEqual() function although low values are used, so this benchmark is not pure non Big Integer - Big Integer test.)
Data consisted of 5 polygon sets: Arrows, Texts, Spiral, Grid & star and Glyph. Total amount of points in all 107 sub polygons was 3641. The heaviest was Arrows set, which had 1885 points. Texts and Grid & star were mid-heavy, with 662 and 523 points. The lightest were Glyph and Spiral, with 369 and 202 points.
This test measured the time that browser's Javascript engine uses executing 435 times ClipperLib.Clipper.OffsetPolygons() function and 360 times ClipperLib.Clipper.Execute() function with the provided data. The total amount of function calls was 795. These times were so high, because nearly all possible combinations of various function arguments were used and offsetting was done using four delta values (-5, 0, 10 and 30) on each of original and result polygons. All different joinTypes were used, and in case of Miter also different miterLimits were used.
Before starting measurement, all coordinates and delta values were multiplied with scale factor, which was 100 in Normal benchmark and 100,000,000 in Big integer benchmark.
Only the time that was spent executing above mentioned two functions was taken into account. The internal calls were not measured twice, eg. when Offset()-function calls internally Execute()-function. All other times were ignored, eg. the time that browser spends on drawing SVG or updating Polygon Explorer.
In order to increase accuracy of the results, the test was repeated five times in each of the browsers and the average of these results was used. To ensure that the differences between browsers are statistically significant, the error range (the difference between individual results and the average of the individual results) was calculated.
To avoid memory and processing power issues, only one browser ran at once and unnecessary programs were closed during testing.
Normal benchmark used low integers. All coordinates were scaled by scaling factor 100, so that as a result of scaling, the minimum coordinate was 1,226 and the maximum was 47,182.
Let's take a look at the results of Normal benchmark. To make it easier to analyze results we present below an image that has enlarged X-axis.
Chrome and Chromium were the fastest browsers and this test didn't find significant difference between them. Both of them ran the suite in average time of 6.0 - 6.1 seconds which is 2.07 times faster than the competitor in second place (IE 10) and 9.28 times faster than the last one (IE 9).
The most conspicuous feature among the results is the huge amount of speed increase when switching from IE 9 to IE 10. IE 10 is 4.49 times faster than IE 9.
To show a X axis which is strictly comparable with Big Integer test, we present below the same image with non-enlarged X-axis:
Clipper automatically switches to using big integer calculations when upscaled coordinates exceeds ClipperLib.ClipperBase.loRange, which is 47,453,132 ie. sqrt(2^53 -1)/2.
All coordinates were scaled by the scaling factor 100,000,000, so that after scaling, the minimum coordinate was 1,226,000,000 and the maximum was 47,182,000,000.
In big integer test the winner is Chromium. The second one is Chrome. Like in Normal benchmark, the Chrome/Chromium scores nearly identical results and are 1.84 - 2.02 times faster than the next non-Chromium browser, which in this case is Opera. The winner Chromium is 6.01 times faster than the last in this test, Safari.
The combined test consists of the combined results of the normal and big integer tests and give a good average of speed differences when using both small and big integers.
In combined test the winners are Chromium and Chrome with scores 36.5 and 39.6. The difference between these two is not significant and this test cannot reliably say which one of those is faster.
The winners are clearly winners. They outperforms the next one (IE 10 with score 81.5) by factor 2.06 - 2.23 and the last one (Safari with score 209.4) by factor 5.29 - 5.74.
The most interesting result of this combined test is that while Safari is in low integer test nearly twice as fast than IE 9, in big integer test IE 9 is clearly faster, which causes that IE9 is faster than Safari in combined test.
The clear winner in all of the tests is a pair of the horses Chromium and Chrome.
For someone Chrome and Chromium are the same browser with different version number, but for others they are different browsers. Chromium is a little faster than Chrome in all of the tests, but the difference is not significant, so thinking them as a same browser is not a bad mistake.
To confirm results we made also single offsetting tests, where we started with delta 0 and increased it to 200 by step +1. Chrome and Chromium had no problems in this test, while some of the others make the browser even non-responsible during few seconds.
This test was executed in 64-bit Windows 7 with Intel i5 processor and the results may be different in other operating systems. The unofficial test showed nearly identical results in Mac OS X 10.6.8 with Intel i7, but of course we could not test IE9-10 in Mac.
What strikes in these results
The performance differences were so huge between Javascript engines. This seems to be the reality in browser world. And this difference is not only noticeable when repeating something, It is really annoying to wait single offsetting operation to last 9 seconds, when only switching to other browser it takes only one second.
We hopefully have not yet seen the best what browser vendors can offer. Why IE 10 is 2.24 - 4.49 times faster than IE 9 in this test? The browser war is not over!
The most recommended browsers
According to these result, the most recommended browser for using Javascript Clipper is Chromium or Chrome. They are at least 1.84 - 2.23 times faster than other tested browsers and even 5.29 - 9.28 times faster than the slowest browsers in the test.
The most non-recommended browsers
According to these results, the most non-recommended browsers for using this library are IE 9 and Safari.
Test date
December 22, 2012
Test library
Javascript Clipper 4.9.7.2
Test platform
CPU: Intel Core i5-2500K CPU @ 3.30GHz (4 cores)
RAM: 8.00 GB
GPU: ATI Radeon HD 4800 Series (512 MB), driver 8.961.0.0
Display: 1920x1200
OS: Windows 7 Professional 64-bit
DirectX: DirectX 10
Tested browsers
Chrome 23.0.1271.97
Chromium 26.0.1366.0
IE 9.0
IE 10.0 Pre
Firefox 17.0
Opera 12.12
Safari 5.1.7 534.57.2