src/es5.js
function markChangesSweep(drafts) {
    // The natural order of drafts in the `scope` array is based on when they
    // were accessed. By processing drafts in reverse natural order, we have a
    // better chance of processing leaf nodes first. When a leaf node is known to
    // have changed, we can avoid any traversal of its ancestor nodes.
    for (let i = drafts.length - 1; i >= 0; i--) {
        const state = drafts[i][DRAFT_STATE]
        if (!state.modified) {
            if (Array.isArray(state.base)) {
                if (hasArrayChanges(state)) markChanged(state)
            } else if (hasObjectChanges(state)) markChanged(state)
        }
    }
}
function markChangesSweep(drafts) {
    // The natural order of drafts in the `scope` array is based on when they
    // were accessed. By processing drafts in reverse natural order, we have a
    // better chance of processing leaf nodes first. When a leaf node is known to
    // have changed, we can avoid any traversal of its ancestor nodes.
    for (let i = drafts.length - 1; i >= 0; i--) {
        const state = drafts[i][DRAFT_STATE]
        if (!state.modified) {
            if (Array.isArray(state.base)) {
                if (hasArrayChanges(state)) markChanged(state)
            } else if (hasObjectChanges(state)) markChanged(state)
        }
    }
}
function markChangesSweep ( drafts ) { // The natural order of drafts in the `scope` array is based on when they // were accessed. By processing drafts in reverse natural order, we have a // better chance of processing leaf nodes first. When a leaf node is known to // have changed, we can avoid any traversal of its ancestor nodes. for ( let i = drafts . length - 1 ; i >= 0 ; i -- ) { const state = drafts [ i ] [ DRAFT_STATE ] if ( ! state . modified ) { if ( Array . isArray ( state . base ) ) { if ( hasArrayChanges ( state ) ) markChanged ( state ) } else if ( hasObjectChanges ( state ) ) markChanged ( state ) } } }
This looks expensive, but only proxies are visited, and only objects without known changes are scanned.
This looks expensive but only proxies are visited and only objects without known changes are scanned .