Performance of Assigning variables in JavaScript (v6)

Revision 6 of this benchmark created on


Description

http://stackoverflow.com/q/8624939/

Replaced location with locatio for the test.

Setup

window.locatio = {};
    window.id="yahoo"; //Declare global variable

Test runner

Ready to run.

Testing in
TestOps/sec
if-elseif
// async test
if(ev === 'drag') {
                        posX = evGesture.deltaX + lastPosX;
            posY = evGesture.deltaY + lastPosY;
                } else {
                        lastPosX = posX;
                        lastPosY = posY;
                }
ready
Switch
// async test
switch(ev) {
            case 'drag':
                        posX = ev.gesture.deltaX + lastPosX;
                        posY = ev.gesture.deltaY + lastPosY;
                break;

                        case 'dragend':
                                lastPosX = posX;
                                lastPosY = posY;
                                break;
        }
ready

Revisions

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