Two.js vector perf (v2)

Revision 2 of this benchmark created on


Preparation HTML

<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.1/underscore-min.js"></script>
<script src="https://rawgit.com/jonobr1/two.js/master/third-party/events.js"></script>

// Unmodded
<script src="https://rawgit.com/DieBuche/e5589db1d04e15277789/raw/5aa71179a0038dd129a29aa8b4204861775d128a/gistfile1.js"></script>

<script>window.TwoMaster = Two; Two.noConflict();</script>



// My version
<script src="https://rawgit.com/DieBuche/770ce33e35a7c4472899/raw/567ffe66a128ab996b1dd88b864f18bce46cb1db/gistfile1.js"></script>

<script>window.TwoMine = Two; Two.noConflict();</script>

// My version, only the smaller changes
<script src="https://rawgit.com/DieBuche/5a58cbbe05c4e8d2d8e6/raw/c630f3879fbfe4397e560fb9d5c790de1134c46a/mine-small-fixes.js"></script>

<script>window.TwoMineSmall = Two;</script>

<svg version="1.1" id="City" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
         viewBox="0 0 595.3 841.9" style="enable-background:new 0 0 595.3 841.9;" xml:space="preserve">
<style type="text/css">
        .st0{fill:#F19D01;}
        .st1{fill:none;stroke:#616160;stroke-width:0.5839;stroke-linejoin:bevel;stroke-miterlimit:10;}
        .st2{fill:#4A8F9E;}
        .st3{fill:#F2F1F1;}
        .st4{fill:#66C3D8;}
        .st5{fill:#B8B8B8;}
        .st6{fill:#5A9488;}
        .st7{fill:#77BF92;}
        .st8{fill:#EB631A;}
        .st9{fill:#B24C18;}
        .st10{fill:none;stroke:#616160;stroke-width:0.5839;stroke-miterlimit:10;}
        .st11{fill:#B87912;}
</style>
<g>
        <polygon class="st0" points="143.7,646.9 130.9,655.7 118.5,655.1 125,663.9 134.8,665.9 143.7,660.6 145.3,654.6  "/>
        <line class="st1" x1="143.7" y1="646.9" x2="176.3" y2="802.1"/>
        <line class="st1" x1="144.7" y1="646.4" x2="177.3" y2="801.6"/>
</g>
<g>
        <g>
                <polygon class="st2" points="296.4,408.7 330.6,404.7 367.8,408.7 367.8,410.3 330.7,407.1 297.6,410.6            "/>
                <polygon class="st3" points="296.4,410.3 330.7,407.1 367.8,410.3 345.1,413.3            "/>
                <rect x="305.9" y="388.6" class="st0" width="2" height="22.4"/>
                <rect x="316.9" y="395.4" class="st0" width="2" height="14.2"/>
                <rect x="341.5" y="388.6" class="st0" width="2" height="21.9"/>
                <rect x="327.9" y="390" class="st0" width="2" height="19.7"/>
                <rect x="351.3" y="388.6" class="st0" width="2" height="21.9"/>
                <polygon class="st3" points="345.1,597.4 296.4,594.4 296.4,408.9 345.1,411.9            "/>
                <polygon class="st4" points="343.8,601.6 295.2,598.7 295.2,595.7 343.8,598.7            "/>
                <polygon class="st4" points="345.1,414.7 296.4,411.6 296.4,408.7 345.1,411.6            "/>
                <polygon class="st2" points="345.1,411.6 367.8,408.7 367.8,411.6 345.1,414.7            "/>
                <polygon class="st5" points="367.8,590.6 345.1,596 345.1,414.7 367.8,411.6              "/>
                <polygon class="st6" points="304.8,363.9 292.9,381 298.4,390.7 304.3,395.9 318.2,396.4 323.9,386.1 313,383 313,368.1            "/>
                <polygon class="st7" points="312.4,366 308.3,376.3 302.3,382.3 306.2,389.5 311.3,390.9 311.9,396.6 318,399.9 329.3,393.7 
                        331.2,385 327.2,369.6 319.6,367.2 316.9,369.7           "/>
                <polygon class="st6" points="355.6,367.8 337.7,377.2 347.5,393.3 360,391.5 361.4,376.5          "/>
                <polygon class="st6" points="322.8,360.6 321.8,369.8 316.9,377.2 319,389.2 327.6,396.9 337.1,400.9 342.4,385.2 335.5,358.5 
                        328.4,361.2             "/>
                <polygon class="st7" points="340.7,361.4 327.6,377.9 339.7,396.3 357.4,385.7            "/>
                <g>
                        <g>
                                <polygon class="st4" points="335.5,437.1 335.5,420.9 335.5,420.5 335.2,420.5 333.8,422.4 333.8,438.7 340.6,439.3 
                                        340.6,437.5                             "/>
                                <polygon class="st2" points="335.5,437.1 340.6,437.5 340.6,422.8 339.3,420.6 335.5,420.5 335.5,420.9                            "/>
                        </g>
                        <g>
                                <polygon class="st4" points="324.9,436.1 324.9,419.8 324.8,419.5 324.7,419.5 323.1,421.4 323.1,437.7 330,438.2 330,436.5 
                                                                        "/>
                                <polygon class="st2" points="324.9,436.1 330,436.5 330,421.8 328.7,419.6 324.8,419.5 324.9,419.8                                "/>
                        </g>
                        <g>
                                <polygon class="st4" points="314.3,435.1 314.3,418.8 314.2,418.4 314.1,418.4 312.5,420.3 312.5,436.6 319.3,437.2 
                                        319.3,435.4                             "/>
                                <polygon class="st2" points="314.3,435.1 319.3,435.4 319.3,420.7 318.1,418.5 314.2,418.4 314.3,418.8                            "/>
                        </g>
                        <g>
                                <polygon class="st4" points="302.9,434 302.9,417.7 302.8,417.4 302.7,417.4 301.2,419.3 301.2,435.6 308,436.1 308,434.4                          
                                        "/>
                                <polygon class="st2" points="302.9,434 308,434.4 308,419.7 306.7,417.5 302.8,417.4 302.9,417.7                          "/>
                        </g>
                </g>
        </g>
        <g>
                <polyline class="st8" points="367.8,509.5 374.7,514 367.8,514           "/>
                <polygon class="st8" points="374.7,514 367.8,514 367.8,518.1 373.8,525.1 380,525.1              "/>
                <g>
                        <polygon class="st8" points="308.4,609.6 305.1,607.2 305.1,581.8 309.2,582.2                    "/>
                        <g>
                                <polygon class="st9" points="385.1,542.1 380,525.1 377.1,519.1 225.1,602.9 227.2,610.5 297.6,609.5 298.5,585.3 308.4,584.2 
                                        308.4,609.6 385.1,609.6                                 "/>
                                <polygon class="st8" points="364.6,518.1 364.6,523.3 355.5,523.3 355.5,528.3 346.3,528.3 346.3,533.4 337.2,533.4 
                                        337.2,538.5 328,538.5 328,543.6 318.8,543.6 318.8,548.7 309.7,548.7 309.7,553.7 300.5,553.7 300.5,558.8 291.4,558.8 
                                        291.4,563.9 282.2,563.9 282.2,569 273,569 273,574 263.8,574 263.8,579.1 254.7,579.1 254.7,584.2 245.6,584.2 245.6,589.3 
                                        236.4,589.3 236.4,594.3 227.2,594.3 227.2,599.5 218,599.5 218,606.6 227.2,610.5 227.2,604.5 236.4,604.5 236.4,599.5 
                                        245.6,599.5 245.6,594.3 254.7,594.3 254.7,589.3 263.8,589.3 263.8,584.2 273,584.2 273,579.1 282.2,579.1 282.2,574 
                                        291.4,574 291.4,569 300.5,569 300.5,563.9 309.7,563.9 309.7,558.8 318.8,558.8 318.8,553.7 328,553.7 328,548.7 337.2,548.7 
                                        337.2,543.6 346.3,543.6 346.3,538.5 355.5,538.5 355.5,533.4 364.6,533.4 364.6,528.3 373.8,528.3 373.8,523.3 373.8,518.1 
                                                                        "/>
                        </g>
                </g>
        </g>
</g>
<g>
        <polygon class="st8" points="273.8,747.1 272.5,736.8 274.5,715.6 266.3,717.3 265.2,736.5 266.4,747.7 266.9,760.7 271,762.1 
                274.9,760.7     "/>
        <polygon class="st9" points="274.9,760.7 271.1,762.1 270,748.6 269.3,738.1 270,732.7 270,724.2 270,717.9 274.5,715.6 
                272.5,736.8 273.8,747.1         "/>
        <polygon class="st7" points="266.9,539.2 272.8,536.9 278.3,560.9 282.7,564 285.8,578.9 288,599.2 293.7,602.4 291.3,615.4 
                291.3,624.1 295.9,629.8 292.8,654.4 299,668.4 299.7,683.7 302.9,694.4 300,708.7 291.3,715.9 275.1,719.2 258.7,722.1 
                244.2,715.3 233.7,695.3 239.7,687.4 238.8,669.4 245.8,647.7 244.2,631.6 252,620.8 252.5,599.2 259,593.9 258.4,573.6 
                264.1,569.1 264.3,553.5 265.6,546.1     "/>
        <polygon class="st6" points="282.7,564 272.1,598.4 279.1,625.2 275.1,644.3 268.3,663.6 268.3,682.3 275.5,699 272.6,715.1 
                272.4,720.1 291.3,715.9 300,708.7 302.9,694.4 299.7,683.7 299,668.4 292.8,654.4 295.9,629.8 291.3,624.1 291.3,615.4 
                293.7,602.4 288,599.2 285.8,578.9       "/>
</g>
<g>
        <g>
                <g>
                        <g>
                                <polyline class="st10" points="495.1,522.5 496,514.8 524.5,512.1 524.5,518.8                            "/>
                                <line class="st10" x1="495.6" y1="517.9" x2="524.5" y2="514.7"/>
                                <line class="st10" x1="505.6" y1="513.9" x2="505" y2="521.2"/>
                                <line class="st10" x1="511.9" y1="513.3" x2="511.7" y2="520.4"/>
                                <line class="st10" x1="518.6" y1="512.6" x2="518.6" y2="519.3"/>
                        </g>
                        <polygon class="st3" points="525.8,599.1 525.8,523.3 515.8,520.9 515.8,593.2                    "/>
                        <polygon class="st3" points="534.5,522 475.9,529.4 468.8,526.4 525.8,519.7                      "/>
                        <polygon class="st3" points="534.5,520.3 475.9,527.7 468.8,524.6 525.8,518                      "/>
                        <polygon class="st5" points="525.8,522.8 534.5,522 534.5,604.3 525.8,599.1                      "/>
                        <polygon class="st5" points="475.9,529.4 475.9,527.7 534.5,520.3 534.5,522                      "/>
                        <polygon class="st3" points="468.8,524.6 468.8,526.4 475.9,529.4 475.9,527.7                    "/>
                        <polyline class="st10" points="502.8,524.2 503.8,516.1 534.1,513.1 534.1,520.3                  "/>
                        <line class="st10" x1="503.4" y1="519.3" x2="534.1" y2="516"/>
                        <line class="st10" x1="514" y1="515.1" x2="513.4" y2="522.8"/>
                        <line class="st10" x1="520.7" y1="514.4" x2="520.6" y2="522"/>
                        <line class="st10" x1="527.9" y1="513.7" x2="527.9" y2="520.9"/>
                </g>
                <g>
                        <polygon class="st4" points="375.5,607.4 486.4,590.2 543.8,623.9 413.1,652.2                    "/>
                        <polygon class="st5" points="375.5,607.4 375.5,600.1 486.1,582.9 546.5,617.8 543.8,623.9 486.4,590.2                    "/>
                        <path class="st3" d="M488.2,576l-130.8,19.9l50.8,63.7L573,623.9L488.2,576z M375.5,600.1L486.1,583l60.5,34.9L414.4,645
                                L375.5,600.1z"/>
                </g>
                <g>
                        <polyline class="st1" points="393.2,610.3 393.2,592.5 388.6,588.2 388.6,596.3                   "/>
                        <polyline class="st1" points="398.8,609.5 398.8,591.6 394.3,587.3 394.3,595.4                   "/>
                        <line class="st1" x1="393.2" y1="607.7" x2="398.8" y2="606.9"/>
                        <line class="st1" x1="393.2" y1="605.4" x2="398.8" y2="604.6"/>
                        <line class="st1" x1="393.2" y1="603.2" x2="398.8" y2="602.3"/>
                        <line class="st1" x1="393.2" y1="600.8" x2="398.8" y2="600"/>
                        <line class="st1" x1="393.2" y1="598.6" x2="398.8" y2="597.7"/>
                </g>
        </g>
        <polygon class="st7" points="357.4,595.9 357.4,722.5 408.2,738 408.2,659.6      "/>
        <polygon id="XMLID_26_" class="st6" points="573,623.9 408.2,659.6 408.2,738 546.5,728 577.3,724.8       "/>
</g>
<g>
        <polygon class="st3" points="527.1,757.1 527.8,787.7 544.2,801.9 544.2,764.5    "/>
        <polygon class="st5" points="544.2,764.5 565.9,761 565.9,795.3 544.2,801.9      "/>
        <g>
                <polygon class="st3" points="527.1,757.1 548.1,748.2 565.9,761 544.2,764.5              "/>
                <polygon class="st0" points="562.2,759 560.6,750.4 558.9,744.2 554.3,739.7 550.9,739.9 542.4,740.6 535.8,744.3 534.3,750.3 
                        533.7,756.3 539.4,759.6 546.5,761.9 556.8,760.1                 "/>
                <polygon class="st11" points="544.1,740.5 548.1,746.1 548.1,751.8 546.7,756.9 546.5,761.9 548.9,761.4 556.8,760.1 562.2,759 
                        560.6,750.4 558.9,744.2 554.3,739.7             "/>
                <polygon class="st0" points="541.9,741.3 538.6,731.5 540.6,721.8 542.9,716.9 547.3,714.8 551.9,715.3 554.7,723.2 555.4,731.6 
                        554.3,739.7 551.7,741.3 549.2,742.9             "/>
                <polygon class="st0" points="543.3,722.7 538.9,728.3 536.2,730.4 537.1,732.7 540.2,732.5 545.2,727.3 547.3,724.4 545.5,721.8 
                                        "/>
                <polygon class="st11" points="547.3,714.8 550.1,719 550.6,730 550.9,735.7 549.2,740.1 546.7,742.4 549.2,742.9 554.3,739.7 
                        555.4,731.6 554.7,723.2 551.9,715.3             "/>
                <polygon class="st11" points="538.2,732.6 541.8,729 544.4,725.4 545,723.2 545,722 545.5,721.8 547.3,724.4 545.2,727.3 
                        540.2,732.5             "/>
        </g>
</g>
<path class="st3" d="M285.6,551.3"/>
</svg>







<script>element = document.getElementById('City')</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Master
var a = new TwoMaster();
a.interpret(element);
 
ready
Mine
var a = new TwoMine();
a.interpret(element);
 
ready
Mine, only small changes
var a = new TwoMineSmall();
a.interpret(element);
 
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.