Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36
Chrome 92
Linux
Desktop
3 years ago
Test name Executions per second
Object assign 4088552.0 Ops/sec
Object spread 49143572.0 Ops/sec
Script Preparation code:
AخA
 
const logging = {
    maskLogging: true,
    maskAnalytics: false,
    disableConversations: true
}
Tests:
  • Object assign

     
    const logging = {
        maskLogging: true,
        maskAnalytics: false,
        disableConversations: true
    }
    const myCopy = Object.assign({}, logging)
  • Object spread

     
    const logging = {
        maskLogging: true,
        maskAnalytics: false,
        disableConversations: true
    }
    const myCopy = { ...logging }