Skip to content

[performance] Object.assign() should be avoided #17

@t2ym

Description

@t2ym

[performance] Object.assign() should be avoided

Root Cause

For jsonPath, Object.assign() looks shorter but is very slow compared with property assignment.

Workaround

Use property assignment instead. It is about 3 times faster than Object.assign()

let jsonPath = [];
jsonPath.errors = [];
jsonPath.recoveryMethod = "undefined";
let obj = new MyClass(jsonObj, jsonPath); 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions