-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: rework benchmark for multi-mode comparisons
- Loading branch information
Showing
10 changed files
with
519 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
class Test { | ||
constructor(num = 123) { | ||
this.value = num; | ||
this.items = [1, 2, 3]; | ||
} | ||
get number() { | ||
return this.value; | ||
} | ||
} | ||
|
||
module.exports = { | ||
regexp: /foo[\\\/](?=\d)/, | ||
array: [ | ||
new Date(), | ||
new Date(100), | ||
'invalid date', | ||
Date.now(), | ||
], | ||
map: new Map([ | ||
[{ foo: 1 }, { a: 1 }], | ||
[{ bar: 2 }, { b: 2 }], | ||
]), | ||
set: new Set([ | ||
{ foo: 1 }, { bar: 2 }, [1, 2, 3] | ||
]), | ||
custom: new Test(456), | ||
int8arr: new Int8Array([4, 5, 6]), | ||
dataview: new DataView(new ArrayBuffer(4)), | ||
buffer: Buffer.from('hello'), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const symbol1 = Symbol('foo'); | ||
const symbol2 = Symbol('bar'); | ||
|
||
const item = { | ||
regexp: /foo[\\\/](?=\d)/, | ||
array: [ | ||
new Date(), | ||
new Date(100), | ||
'invalid date', | ||
Date.now(), | ||
], | ||
map: new Map([ | ||
[{ foo: 1 }, { a: 1 }], | ||
[{ bar: 2 }, { b: 2 }], | ||
]), | ||
set: new Set([ | ||
{ foo: 1 }, { bar: 2 }, [1, 2, 3] | ||
]), | ||
int8arr: new Int8Array([4, 5, 6]), | ||
buffer: Buffer.from('hello'), | ||
symbol1: symbol1, | ||
symbol2: symbol2, | ||
[symbol1]: 'hello', | ||
[symbol2]: [1, 2, 3, 4] | ||
} | ||
|
||
Object.defineProperty(item, 'hidden1', { | ||
enumerable: false, | ||
value: 'found me' | ||
}); | ||
|
||
Object.defineProperty(item, 'hidden2', { | ||
enumerable: false, | ||
value: [1, 2, 3] | ||
}); | ||
|
||
Object.defineProperty(item, 'secret', { | ||
enumerable: false, | ||
get() { | ||
return 'password'; | ||
} | ||
}); | ||
|
||
module.exports = item; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
module.exports = [ | ||
{ | ||
"_id": "5e16d8c6d7eee2857c907fbe", | ||
"index": 0, | ||
"nickname": null, | ||
"isActive": false, | ||
"balance": 2077.55, | ||
"picture": "http://placehold.it/32x32", | ||
"age": 33, | ||
"details": { | ||
"email": "ericksonphillips@retrotex.com", | ||
"address": { | ||
"street": "554 Lyme Avenue", | ||
"city": "Harborton", | ||
"state": "Texas", | ||
"zipcode": 4945, | ||
"coords": { | ||
"latitude": 61.497735, | ||
"longitude": -38.711066 | ||
} | ||
} | ||
}, | ||
"interests": [ | ||
"amet", | ||
"voluptate", | ||
"sit", | ||
"duis", | ||
"fugiat", | ||
"consectetur", | ||
"amet" | ||
], | ||
"friends": [ | ||
{ | ||
"id": 0, | ||
"name": "Belinda Chandler", | ||
"friends_common": { | ||
"count": 2, | ||
"friends_of_friends": [ | ||
{ | ||
"id": 0, | ||
"name": "George Ayala" | ||
}, | ||
{ | ||
"id": 1, | ||
"name": "Nadia Nguyen" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"id": 1, | ||
"name": "Sheena Kidd", | ||
"friends_common": { | ||
"count": 2, | ||
"friends_of_friends": [ | ||
{ | ||
"id": 0, | ||
"name": "Kimberly Martinez" | ||
}, | ||
{ | ||
"id": 1, | ||
"name": "Meadows Fitzpatrick" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"id": 2, | ||
"name": "Winnie Mccarthy", | ||
"friends_common": { | ||
"count": 2, | ||
"friends_of_friends": [ | ||
{ | ||
"id": 0, | ||
"name": "Robbie Dale" | ||
}, | ||
{ | ||
"id": 1, | ||
"name": "Orr Houston" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"_id": "5e16d8c6ed426d1c22bf306b", | ||
"index": 1, | ||
"nickname": null, | ||
"isActive": false, | ||
"balance": 2916.08, | ||
"picture": "http://placehold.it/32x32", | ||
"age": 20, | ||
"details": { | ||
"email": "orrhouston@retrotex.com", | ||
"address": { | ||
"street": "962 McDonald Avenue", | ||
"city": "Lithium", | ||
"state": "West Virginia", | ||
"zipcode": 4536, | ||
"coords": { | ||
"latitude": 83.372808, | ||
"longitude": 150.181923 | ||
} | ||
} | ||
}, | ||
"interests": [ | ||
"eu", | ||
"et", | ||
"dolore", | ||
"sunt", | ||
"elit", | ||
"nulla", | ||
"fugiat" | ||
], | ||
"friends": [ | ||
{ | ||
"id": 0, | ||
"name": "Hood Washington", | ||
"friends_common": { | ||
"count": 2, | ||
"friends_of_friends": [ | ||
{ | ||
"id": 0, | ||
"name": "Hebert Delacruz" | ||
}, | ||
{ | ||
"id": 1, | ||
"name": "Sharp Rose" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"id": 1, | ||
"name": "Karla Velasquez", | ||
"friends_common": { | ||
"count": 2, | ||
"friends_of_friends": [ | ||
{ | ||
"id": 0, | ||
"name": "Carey Holman" | ||
}, | ||
{ | ||
"id": 1, | ||
"name": "Baird Short" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"id": 2, | ||
"name": "Juliet Oneal", | ||
"friends_common": { | ||
"count": 2, | ||
"friends_of_friends": [ | ||
{ | ||
"id": 0, | ||
"name": "Owens Richards" | ||
}, | ||
{ | ||
"id": 1, | ||
"name": "Lily Olsen" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
] |
File renamed without changes.
Oops, something went wrong.