index2: Improve performance using native isArray and avoiding for-in loops

About 30% performance improvement (from 170ms to 120ms).

* Use native Array.isArray instead of comparing [[Class]] via toString.
  Seems to reliably save about 10ms in performance, and makes more sense
  in general.

* Cache hasOwnProperty.
  Instead of requesting a global variable and two property levels inside
  the loop, cache it once.

* Don't use a for-in loop over an array.
  For-in loops are for objects, not arrays. They scan through the
  entire inheritance chain (thus needing a hasOwn check) and they
  potentially yield keys in the wrong order (ironic, since this
  code is all about avoiding internal sort and using alphabetical
  instead).

Performance (average of 10 runs):

- Before (2167f41)
  - native: 46-48ms
  - js stringify with js sort: 165-173ms
  - native stringify with js sort: 170-176ms
- After
  - native: 47-53ms
  - js stringify with js sort: 165-171ms
  - native stringify with js sort: 124-129ms