Skip to content

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

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); 

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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