@@ -196,7 +196,34 @@ module.exports = function typeDetect(obj) {
196
196
}
197
197
}
198
198
199
- if ( getPrototypeOfExists && ( symbolToStringTagExists === false || typeof obj [ Symbol . toStringTag ] === 'undefined' ) ) {
199
+ /* ! Speed optimisation
200
+ * Pre:
201
+ * Float64Array x 625,644 ops/sec ±1.58% (80 runs sampled)
202
+ * Float32Array x 1,279,852 ops/sec ±2.91% (77 runs sampled)
203
+ * Uint32Array x 1,178,185 ops/sec ±1.95% (83 runs sampled)
204
+ * Uint16Array x 1,008,380 ops/sec ±2.25% (80 runs sampled)
205
+ * Uint8Array x 1,128,040 ops/sec ±2.11% (81 runs sampled)
206
+ * Int32Array x 1,170,119 ops/sec ±2.88% (80 runs sampled)
207
+ * Int16Array x 1,176,348 ops/sec ±5.79% (86 runs sampled)
208
+ * Int8Array x 1,058,707 ops/sec ±4.94% (77 runs sampled)
209
+ * Uint8ClampedArray x 1,110,633 ops/sec ±4.20% (80 runs sampled)
210
+ * Post:
211
+ * Float64Array x 7,105,671 ops/sec ±13.47% (64 runs sampled)
212
+ * Float32Array x 5,887,912 ops/sec ±1.46% (82 runs sampled)
213
+ * Uint32Array x 6,491,661 ops/sec ±1.76% (79 runs sampled)
214
+ * Uint16Array x 6,559,795 ops/sec ±1.67% (82 runs sampled)
215
+ * Uint8Array x 6,463,966 ops/sec ±1.43% (85 runs sampled)
216
+ * Int32Array x 5,641,841 ops/sec ±3.49% (81 runs sampled)
217
+ * Int16Array x 6,583,511 ops/sec ±1.98% (80 runs sampled)
218
+ * Int8Array x 6,606,078 ops/sec ±1.74% (81 runs sampled)
219
+ * Uint8ClampedArray x 6,602,224 ops/sec ±1.77% (83 runs sampled)
220
+ */
221
+ var stringTag = ( symbolToStringTagExists && obj [ Symbol . toStringTag ] ) ;
222
+ if ( typeof stringTag === 'string' ) {
223
+ return stringTag . toLowerCase ( ) ;
224
+ }
225
+
226
+ if ( getPrototypeOfExists ) {
200
227
var objPrototype = Object . getPrototypeOf ( obj ) ;
201
228
/* ! Speed optimisation
202
229
* Pre:
0 commit comments