Tests:

Historical Performance Data aggregated from 41 community runs

Desktop Results:
Chrome 31 runs
Using For-In loop
58.6M/s
Using the spread operator
34.3M/s
Using Object.assign
10.8M/s
Using For-In loop with hasOwnProperty
6.8M/s

Fastest: Using For-In loop (8.6x faster)

View exact numbers
  • Using For-In loop: 58,622,980 ops/sec
  • Using the spread operator: 34,328,856 ops/sec
  • Using Object.assign: 10,773,756 ops/sec
  • Using For-In loop with hasOwnProperty: 6,839,729 ops/sec
Firefox 10 runs
Using For-In loop
23.7M/s
Using Object.assign
17.0M/s
Using For-In loop with hasOwnProperty
11.9M/s
Using the spread operator
10.2M/s

Fastest: Using For-In loop (2.3x faster)

View exact numbers
  • Using For-In loop: 23,674,884 ops/sec
  • Using Object.assign: 16,963,084 ops/sec
  • Using For-In loop with hasOwnProperty: 11,926,582 ops/sec
  • Using the spread operator: 10,196,156 ops/sec

Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    Using the spread operator
    Using Object.assign
    Using For-In loop
    Using For-In loop with hasOwnProperty

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 8 months ago)
Mozilla/5.0 (X11; Linux x86_64; rv:145.0) Gecko/20100101 Firefox/145.0
Firefox 145 on Linux
View result in a separate tab
Using For-In loop
16.3M/s
Using Object.assign
13.5M/s
Using For-In loop with hasOwnProperty
10.1M/s
Using the spread operator
9.4M/s
View exact numbers
Test name Executions per second
Using For-In loop 16,262,519 Ops/sec
Using Object.assign 13,491,494 Ops/sec
Using For-In loop with hasOwnProperty 10,132,150 Ops/sec
Using the spread operator 9,416,741 Ops/sec