Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
last-item-in-array-pop-vs-array-position-real-conditions
(version: 0)
Comparing performance of:
1 vs 2
Created:
2 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var arr = [ { "stopId": "12334", "stopIndex": 0, "stopCount": 19, "scheduledArrival": 43920, "scheduledDeparture": 43920, "realtimeArrival": 43920, "realtimeDeparture": 43920, "arrivalDelay": 0, "departureDelay": 0, "timepoint": true, "realtime": true, "realtimeState": "ADDED", "serviceDay": 1692741600, "tripId": "12344", "headsign": "123444", "scheduledArrivalTimestamp": 1692785520000, "scheduledDepartureTimestamp": 1692785520000, "realtimeArrivalTimestamp": 1692785520000, "realtimeDepartureTimestamp": 1692785520000, "arrivalDelayText": "", "departureDelayText": "", "canceled": false, "stop": { "id": "CH", "code": "abcd", "name": "adcdc", "lat": 46.5218479, "lon": 6.667098, "stationId": "CHsddsdsd", "cluster": "dfdfdf", "didok": "sfdfdf" }, "route": { "id": "edf", "code": "7", "agency": { "id": "edf", "name": "xxx", "timezone": "Europe/Berlin", "shortName": "dfdf" }, "shortName": "7", "longName": "B 7", "mode": "bus", "type": 3, "color": "#2E3192", "textColor": "#FFFFFF", "bikesAllowed": 1 }, "patternId": "fkfkfkfk", "directionId": "1" }, { "stopId": "12334", "stopIndex": 0, "stopCount": 19, "scheduledArrival": 43920, "scheduledDeparture": 43920, "realtimeArrival": 43920, "realtimeDeparture": 43920, "arrivalDelay": 0, "departureDelay": 0, "timepoint": true, "realtime": true, "realtimeState": "ADDED", "serviceDay": 1692741600, "tripId": "12344", "headsign": "123444", "scheduledArrivalTimestamp": 1692785520000, "scheduledDepartureTimestamp": 1692785520000, "realtimeArrivalTimestamp": 1692785520000, "realtimeDepartureTimestamp": 1692785520000, "arrivalDelayText": "", "departureDelayText": "", "canceled": false, "stop": { "id": "CH", "code": "abcd", "name": "adcdc", "lat": 46.5218479, "lon": 6.667098, "stationId": "CHsddsdsd", "cluster": "dfdfdf", "didok": "sfdfdf" }, "route": { "id": "edf", "code": "7", "agency": { "id": "edf", "name": "xxx", "timezone": "Europe/Berlin", "shortName": "dfdf" }, "shortName": "7", "longName": "B 7", "mode": "bus", "type": 3, "color": "#2E3192", "textColor": "#FFFFFF", "bikesAllowed": 1 }, "patternId": "fkfkfkfk", "directionId": "1" }, { "stopId": "12334", "stopIndex": 0, "stopCount": 19, "scheduledArrival": 44340, "scheduledDeparture": 44340, "realtimeArrival": 44340, "realtimeDeparture": 44340, "arrivalDelay": 0, "departureDelay": 0, "timepoint": true, "realtime": true, "realtimeState": "ADDED", "serviceDay": 1692741600, "tripId": "12344", "headsign": "123444", "scheduledArrivalTimestamp": 1692785940000, "scheduledDepartureTimestamp": 1692785940000, "realtimeArrivalTimestamp": 1692785940000, "realtimeDepartureTimestamp": 1692785940000, "arrivalDelayText": "", "departureDelayText": "", "canceled": false, "stop": { "id": "CH", "code": "abcd", "name": "adcdc", "lat": 46.5218479, "lon": 6.667098, "stationId": "CHsddsdsd", "cluster": "dfdfdf", "didok": "sfdfdf" }, "route": { "id": "edf", "code": "7", "agency": { "id": "edf", "name": "xxx", "timezone": "Europe/Berlin", "shortName": "dfdf" }, "shortName": "7", "longName": "B 7", "mode": "bus", "type": 3, "color": "#2E3192", "textColor": "#FFFFFF", "bikesAllowed": 1 }, "patternId": "fkfkfkfk", "directionId": "1" }, { "stopId": "12334", "stopIndex": 0, "stopCount": 19, "scheduledArrival": 44340, "scheduledDeparture": 44340, "realtimeArrival": 44340, "realtimeDeparture": 44340, "arrivalDelay": 0, "departureDelay": 0, "timepoint": true, "realtime": true, "realtimeState": "ADDED", "serviceDay": 1692741600, "tripId": "12344", "headsign": "123444", "scheduledArrivalTimestamp": 1692785940000, "scheduledDepartureTimestamp": 1692785940000, "realtimeArrivalTimestamp": 1692785940000, "realtimeDepartureTimestamp": 1692785940000, "arrivalDelayText": "", "departureDelayText": "", "canceled": false, "stop": { "id": "CH", "code": "abcd", "name": "adcdc", "lat": 46.5218479, "lon": 6.667098, "stationId": "CHsddsdsd", "cluster": "dfdfdf", "didok": "sfdfdf" }, "route": { "id": "edf", "code": "7", "agency": { "id": "edf", "name": "xxx", "timezone": "Europe/Berlin", "shortName": "dfdf" }, "shortName": "7", "longName": "B 7", "mode": "bus", "type": 3, "color": "#2E3192", "textColor": "#FFFFFF", "bikesAllowed": 1 }, "patternId": "fkfkfkfk", "directionId": "1" }, { "stopId": "12334", "stopIndex": 0, "stopCount": 19, "scheduledArrival": 44820, "scheduledDeparture": 44820, "realtimeArrival": 44820, "realtimeDeparture": 44820, "arrivalDelay": 0, "departureDelay": 0, "timepoint": true, "realtime": true, "realtimeState": "ADDED", "serviceDay": 1692741600, "tripId": "12344", "headsign": "123444", "scheduledArrivalTimestamp": 1692786420000, "scheduledDepartureTimestamp": 1692786420000, "realtimeArrivalTimestamp": 1692786420000, "realtimeDepartureTimestamp": 1692786420000, "arrivalDelayText": "", "departureDelayText": "", "canceled": false, "stop": { "id": "CH", "code": "abcd", "name": "adcdc", "lat": 46.5218479, "lon": 6.667098, "stationId": "CHsddsdsd", "cluster": "dfdfdf", "didok": "sfdfdf" }, "route": { "id": "edf", "code": "7", "agency": { "id": "edf", "name": "xxx", "timezone": "Europe/Berlin", "shortName": "dfdf" }, "shortName": "7", "longName": "B 7", "mode": "bus", "type": 3, "color": "#2E3192", "textColor": "#FFFFFF", "bikesAllowed": 1 }, "patternId": "fkfkfkfk", "directionId": "1" }, { "stopId": "12334", "stopIndex": 0, "stopCount": 19, "scheduledArrival": 44820, "scheduledDeparture": 44820, "realtimeArrival": 44820, "realtimeDeparture": 44820, "arrivalDelay": 0, "departureDelay": 0, "timepoint": true, "realtime": true, "realtimeState": "ADDED", "serviceDay": 1692741600, "tripId": "12344", "headsign": "123444", "scheduledArrivalTimestamp": 1692786420000, "scheduledDepartureTimestamp": 1692786420000, "realtimeArrivalTimestamp": 1692786420000, "realtimeDepartureTimestamp": 1692786420000, "arrivalDelayText": "", "departureDelayText": "", "canceled": false, "stop": { "id": "CH", "code": "abcd", "name": "adcdc", "lat": 46.5218479, "lon": 6.667098, "stationId": "CHsddsdsd", "cluster": "dfdfdf", "didok": "sfdfdf" }, "route": { "id": "edf", "code": "7", "agency": { "id": "edf", "name": "xxx", "timezone": "Europe/Berlin", "shortName": "dfdf" }, "shortName": "7", "longName": "B 7", "mode": "bus", "type": 3, "color": "#2E3192", "textColor": "#FFFFFF", "bikesAllowed": 1 }, "patternId": "fkfkfkfk", "directionId": "1" }, { "stopId": "12334", "stopIndex": 0, "stopCount": 19, "scheduledArrival": 45300, "scheduledDeparture": 45300, "realtimeArrival": 45300, "realtimeDeparture": 45300, "arrivalDelay": 0, "departureDelay": 0, "timepoint": true, "realtime": true, "realtimeState": "ADDED", "serviceDay": 1692741600, "tripId": "12344", "headsign": "123444", "scheduledArrivalTimestamp": 1692786900000, "scheduledDepartureTimestamp": 1692786900000, "realtimeArrivalTimestamp": 1692786900000, "realtimeDepartureTimestamp": 1692786900000, "arrivalDelayText": "", "departureDelayText": "", "canceled": false, "stop": { "id": "CH", "code": "abcd", "name": "adcdc", "lat": 46.5218479, "lon": 6.667098, "stationId": "CHsddsdsd", "cluster": "dfdfdf", "didok": "sfdfdf" }, "route": { "id": "edf", "code": "7", "agency": { "id": "edf", "name": "xxx", "timezone": "Europe/Berlin", "shortName": "dfdf" }, "shortName": "7", "longName": "B 7", "mode": "bus", "type": 3, "color": "#2E3192", "textColor": "#FFFFFF", "bikesAllowed": 1 }, "patternId": "fkfkfkfk", "directionId": "1" }, { "stopId": "12334", "stopIndex": 0, "stopCount": 19, "scheduledArrival": 45300, "scheduledDeparture": 45300, "realtimeArrival": 45300, "realtimeDeparture": 45300, "arrivalDelay": 0, "departureDelay": 0, "timepoint": true, "realtime": true, "realtimeState": "ADDED", "serviceDay": 1692741600, "tripId": "12344", "headsign": "123444", "scheduledArrivalTimestamp": 1692786900000, "scheduledDepartureTimestamp": 1692786900000, "realtimeArrivalTimestamp": 1692786900000, "realtimeDepartureTimestamp": 1692786900000, "arrivalDelayText": "", "departureDelayText": "", "canceled": false, "stop": { "id": "CH", "code": "abcd", "name": "adcdc", "lat": 46.5218479, "lon": 6.667098, "stationId": "CHsddsdsd", "cluster": "dfdfdf", "didok": "sfdfdf" }, "route": { "id": "edf", "code": "7", "agency": { "id": "edf", "name": "xxx", "timezone": "Europe/Berlin", "shortName": "dfdf" }, "shortName": "7", "longName": "B 7", "mode": "bus", "type": 3, "color": "#2E3192", "textColor": "#FFFFFF", "bikesAllowed": 1 }, "patternId": "fkfkfkfk", "directionId": "1" }, { "stopId": "12334", "stopIndex": 0, "stopCount": 19, "scheduledArrival": 45720, "scheduledDeparture": 45720, "realtimeArrival": 45720, "realtimeDeparture": 45720, "arrivalDelay": 0, "departureDelay": 0, "timepoint": true, "realtime": true, "realtimeState": "ADDED", "serviceDay": 1692741600, "tripId": "12344", "headsign": "123444", "scheduledArrivalTimestamp": 1692787320000, "scheduledDepartureTimestamp": 1692787320000, "realtimeArrivalTimestamp": 1692787320000, "realtimeDepartureTimestamp": 1692787320000, "arrivalDelayText": "", "departureDelayText": "", "canceled": false, "stop": { "id": "CH", "code": "abcd", "name": "adcdc", "lat": 46.5218479, "lon": 6.667098, "stationId": "CHsddsdsd", "cluster": "dfdfdf", "didok": "sfdfdf" }, "route": { "id": "edf", "code": "7", "agency": { "id": "edf", "name": "xxx", "timezone": "Europe/Berlin", "shortName": "dfdf" }, "shortName": "7", "longName": "B 7", "mode": "bus", "type": 3, "color": "#2E3192", "textColor": "#FFFFFF", "bikesAllowed": 1 }, "patternId": "fkfkfkfk", "directionId": "1" }, { "stopId": "12334", "stopIndex": 0, "stopCount": 19, "scheduledArrival": 45720, "scheduledDeparture": 45720, "realtimeArrival": 45720, "realtimeDeparture": 45720, "arrivalDelay": 0, "departureDelay": 0, "timepoint": true, "realtime": true, "realtimeState": "ADDED", "serviceDay": 1692741600, "tripId": "12344", "headsign": "123444", "scheduledArrivalTimestamp": 1692787320000, "scheduledDepartureTimestamp": 1692787320000, "realtimeArrivalTimestamp": 1692787320000, "realtimeDepartureTimestamp": 1692787320000, "arrivalDelayText": "", "departureDelayText": "", "canceled": false, "stop": { "id": "CH", "code": "abcd", "name": "adcdc", "lat": 46.5218479, "lon": 6.667098, "stationId": "CHsddsdsd", "cluster": "dfdfdf", "didok": "sfdfdf" }, "route": { "id": "edf", "code": "7", "agency": { "id": "edf", "name": "xxx", "timezone": "Europe/Berlin", "shortName": "dfdf" }, "shortName": "7", "longName": "B 7", "mode": "bus", "type": 3, "color": "#2E3192", "textColor": "#FFFFFF", "bikesAllowed": 1 }, "patternId": "fkfkfkfk", "directionId": "1" } ]
Tests:
1
arr && arr.map((_) => _.mode).pop() || 'b';
2
arr && arr.length && arr[0]?.mode || 'b'
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
1
2
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
(sortBy + reverse) vs orderBy desc
simple stuffddd
array iteration vs _.each vs map vs for..of vs for loop AP
array iteration vs _.each vs map vs for..of vs for loop AP1
Comments
Confirm delete:
Do you really want to delete benchmark?