const a = [
{
"id":"6ac381cb-b73d-48d5-a6b7-306feec563b0",
"url":"/api/search/savedSearch/6ac381cb-b73d-48d5-a6b7-306feec563b0",
"createdAt":"2021-02-19T17:29:28-0600",
"updatedAt":"2021-02-19T17:29:28-0600",
"siteId":"c4de59d6-3ada-3577-926d-5ed873ee15b3",
"userId":"b9bb488c-34cd-3cdc-babe-d4a8b9b698c4",
"label":"Mexico 8",
"list":{},
"query":"{\"query\":\"\",\"searchWeight\":0,\"filters\":[{\"geoFilter\":{\"or\":[{\"exclude\":false,\"type\":\"country\",\"label\":\"Mexico\",\"value\":\"fba85d57-cc25-3acb-9376-55072c1ea354\"}]}}],\"aggs\":{},\"from\":0,\"size\":25,\"sortBy\":[{\"company\":[{\"numEmployees_l\":\"desc\"}]}],\"types\":[\"company\"]}",
"queryType":"search",
"searchSubscriber":{},
"isSubscribed":false,
"sharedCount":0,
"pinned":true,
"filterDetails":{
"Country/Region":[
"Mexico"
]
},
"pinned":true
},
{
"id":"fa40f13d-35af-4694-9b03-cf63f56babf0",
"url":"/api/search/savedSearch/fa40f13d-35af-4694-9b03-cf63f56babf0",
"createdAt":"2021-02-19T17:29:37-0600",
"updatedAt":"2021-02-19T17:29:37-0600",
"siteId":"c4de59d6-3ada-3577-926d-5ed873ee15b3",
"userId":"b9bb488c-34cd-3cdc-babe-d4a8b9b698c4",
"label":"Mexico 9",
"list":{},
"query":"{\"query\":\"\",\"searchWeight\":0,\"filters\":[{\"geoFilter\":{\"or\":[{\"exclude\":false,\"type\":\"country\",\"label\":\"Mexico\",\"value\":\"fba85d57-cc25-3acb-9376-55072c1ea354\"}]}}],\"aggs\":{},\"from\":0,\"size\":25,\"sortBy\":[{\"company\":[{\"numEmployees_l\":\"desc\"}]}],\"types\":[\"company\"]}",
"queryType":"search",
"searchSubscriber":{},
"isSubscribed":false,
"sharedCount":0,
"pinned":false,
"filterDetails":{
"Country/Region":[
"Mexico"
]
},
"pinned":false
},
{
"id":"7f5e68ed-4fc5-4499-874d-8743c4fbdfe4",
"url":"/api/search/savedSearch/7f5e68ed-4fc5-4499-874d-8743c4fbdfe4",
"createdAt":"2021-02-19T17:29:48-0600",
"updatedAt":"2021-02-19T17:29:48-0600",
"siteId":"c4de59d6-3ada-3577-926d-5ed873ee15b3",
"userId":"b9bb488c-34cd-3cdc-babe-d4a8b9b698c4",
"label":"Mexico 10",
"list":{},
"query":"{\"query\":\"\",\"searchWeight\":0,\"filters\":[{\"geoFilter\":{\"or\":[{\"exclude\":false,\"type\":\"country\",\"label\":\"Mexico\",\"value\":\"fba85d57-cc25-3acb-9376-55072c1ea354\"}]}}],\"aggs\":{},\"from\":0,\"size\":25,\"sortBy\":[{\"company\":[{\"numEmployees_l\":\"desc\"}]}],\"types\":[\"company\"]}",
"queryType":"search",
"searchSubscriber":{},
"isSubscribed":false,
"sharedCount":0,
"pinned":false,
"filterDetails":{
"Country/Region":[
"Mexico"
]
},
"pinned":false
}
]
const b = {
"id": "6ac381cb-b73d-48d5-a6b7-306feec563b0",
"url": "/api/search/savedSearch/6ac381cb-b73d-48d5-a6b7-306feec563b0",
"createdAt": "2021-02-19T17:29:28-0600",
"updatedAt": "2021-02-19T17:29:28-0600",
"siteId": "c4de59d6-3ada-3577-926d-5ed873ee15b3",
"userId": "b9bb488c-34cd-3cdc-babe-d4a8b9b698c4",
"label": "Mexico 8",
"list": {},
"query": "{\"query\":\"\",\"searchWeight\":0,\"filters\":[{\"geoFilter\":{\"or\":[{\"exclude\":false,\"type\":\"country\",\"label\":\"Mexico\",\"value\":\"fba85d57-cc25-3acb-9376-55072c1ea354\"}]}}],\"aggs\":{},\"from\":0,\"size\":25,\"sortBy\":[{\"company\":[{\"numEmployees_l\":\"desc\"}]}],\"types\":[\"company\"]}",
"queryType": "search",
"searchSubscriber": {},
"isSubscribed": false,
"sharedCount": 0,
"pinned": true,
"filterDetails": {
"Country/Region": [
"Mexico"
]
},
"pinned": false
}
a.splice(0,1,b)
const a = [
{
"id":"6ac381cb-b73d-48d5-a6b7-306feec563b0",
"url":"/api/search/savedSearch/6ac381cb-b73d-48d5-a6b7-306feec563b0",
"createdAt":"2021-02-19T17:29:28-0600",
"updatedAt":"2021-02-19T17:29:28-0600",
"siteId":"c4de59d6-3ada-3577-926d-5ed873ee15b3",
"userId":"b9bb488c-34cd-3cdc-babe-d4a8b9b698c4",
"label":"Mexico 8",
"list":{},
"query":"{\"query\":\"\",\"searchWeight\":0,\"filters\":[{\"geoFilter\":{\"or\":[{\"exclude\":false,\"type\":\"country\",\"label\":\"Mexico\",\"value\":\"fba85d57-cc25-3acb-9376-55072c1ea354\"}]}}],\"aggs\":{},\"from\":0,\"size\":25,\"sortBy\":[{\"company\":[{\"numEmployees_l\":\"desc\"}]}],\"types\":[\"company\"]}",
"queryType":"search",
"searchSubscriber":{},
"isSubscribed":false,
"sharedCount":0,
"pinned":true,
"filterDetails":{
"Country/Region":[
"Mexico"
]
},
"pinned":true
},
{
"id":"fa40f13d-35af-4694-9b03-cf63f56babf0",
"url":"/api/search/savedSearch/fa40f13d-35af-4694-9b03-cf63f56babf0",
"createdAt":"2021-02-19T17:29:37-0600",
"updatedAt":"2021-02-19T17:29:37-0600",
"siteId":"c4de59d6-3ada-3577-926d-5ed873ee15b3",
"userId":"b9bb488c-34cd-3cdc-babe-d4a8b9b698c4",
"label":"Mexico 9",
"list":{},
"query":"{\"query\":\"\",\"searchWeight\":0,\"filters\":[{\"geoFilter\":{\"or\":[{\"exclude\":false,\"type\":\"country\",\"label\":\"Mexico\",\"value\":\"fba85d57-cc25-3acb-9376-55072c1ea354\"}]}}],\"aggs\":{},\"from\":0,\"size\":25,\"sortBy\":[{\"company\":[{\"numEmployees_l\":\"desc\"}]}],\"types\":[\"company\"]}",
"queryType":"search",
"searchSubscriber":{},
"isSubscribed":false,
"sharedCount":0,
"pinned":false,
"filterDetails":{
"Country/Region":[
"Mexico"
]
},
"pinned":false
},
{
"id":"7f5e68ed-4fc5-4499-874d-8743c4fbdfe4",
"url":"/api/search/savedSearch/7f5e68ed-4fc5-4499-874d-8743c4fbdfe4",
"createdAt":"2021-02-19T17:29:48-0600",
"updatedAt":"2021-02-19T17:29:48-0600",
"siteId":"c4de59d6-3ada-3577-926d-5ed873ee15b3",
"userId":"b9bb488c-34cd-3cdc-babe-d4a8b9b698c4",
"label":"Mexico 10",
"list":{},
"query":"{\"query\":\"\",\"searchWeight\":0,\"filters\":[{\"geoFilter\":{\"or\":[{\"exclude\":false,\"type\":\"country\",\"label\":\"Mexico\",\"value\":\"fba85d57-cc25-3acb-9376-55072c1ea354\"}]}}],\"aggs\":{},\"from\":0,\"size\":25,\"sortBy\":[{\"company\":[{\"numEmployees_l\":\"desc\"}]}],\"types\":[\"company\"]}",
"queryType":"search",
"searchSubscriber":{},
"isSubscribed":false,
"sharedCount":0,
"pinned":false,
"filterDetails":{
"Country/Region":[
"Mexico"
]
},
"pinned":false
}
]
const b = {
"id": "6ac381cb-b73d-48d5-a6b7-306feec563b0",
"url": "/api/search/savedSearch/6ac381cb-b73d-48d5-a6b7-306feec563b0",
"createdAt": "2021-02-19T17:29:28-0600",
"updatedAt": "2021-02-19T17:29:28-0600",
"siteId": "c4de59d6-3ada-3577-926d-5ed873ee15b3",
"userId": "b9bb488c-34cd-3cdc-babe-d4a8b9b698c4",
"label": "Mexico 8",
"list": {},
"query": "{\"query\":\"\",\"searchWeight\":0,\"filters\":[{\"geoFilter\":{\"or\":[{\"exclude\":false,\"type\":\"country\",\"label\":\"Mexico\",\"value\":\"fba85d57-cc25-3acb-9376-55072c1ea354\"}]}}],\"aggs\":{},\"from\":0,\"size\":25,\"sortBy\":[{\"company\":[{\"numEmployees_l\":\"desc\"}]}],\"types\":[\"company\"]}",
"queryType": "search",
"searchSubscriber": {},
"isSubscribed": false,
"sharedCount": 0,
"pinned": true,
"filterDetails": {
"Country/Region": [
"Mexico"
]
},
"pinned": false
}
a[0] = b
--enable-precise-memory-info
flag.
Test case name | Result |
---|---|
Splice | |
Bracket |
Test name | Executions per second |
---|---|
Splice | 685013.6 Ops/sec |
Bracket | 721127.1 Ops/sec |