HTML Preparation code:
AخA
 
1
<script crossorigin src="https://unpkg.com/immutable-assign@2.0.4/deploy/iassign.js"></script>
Script Preparation code:
 
var state = {
    hasChanged: false,
    name: 'Default state',
    tags: [],
    nested: {
        hasChanged: false,
        name: 'Default nested state',
        tags: [],
        nested: {
            hasChanged: false,
            name: '',
            tags: []
        },
        map: new Map()
    },
    map: new Map()
};
Tests:
  • sequential calls

    x
     
    const s7 = iassign(state, s => {
        s.hasChanged = true;
        return s;
    });
    const s8 = iassign(s7, s => s.nested, nested => {
        nested.hasChanged = true;
        return nested;
    });
    const s9 = iassign(s8, s => s.tags, tags => {
        tags.push('new tag');
        return tags;
    });
  • nested calls

     
    const s10 = iassign(state, s => {
        s.hasChanged = true;
        
        s.nested = iassign(s.nested, nested => {
            nested.hasChanged = true;
            return nested;
        });
        
        s.tags = iassign(s.tags, tags => {
            tags.push('new tag');
            return tags;
        });
        
        return s;
    });
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    sequential calls
    nested calls

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 6 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.79 Safari/537.36
Chrome 67 on Windows
View result in a separate tab
Test name Executions per second
sequential calls 123234.5 Ops/sec
nested calls 364814.5 Ops/sec