array deconstruction (v3)

Revision 3 of this benchmark created on


Setup

const playerCount = 5000;
const a = 100;
const b = 490;

const players = Array.from({ length: playerCount }).fill(0).map((_, player_id) => ({ player_id }));

Test runner

Ready to run.

Testing in
TestOps/sec
in array
const [playerA, playerB] = [
  players.find(player => player.player_id === a),
  players.find(player => player.player_id === b),
];

playerA.player_id;
playerB.player_id;
ready
separate const
const playerA = players.find(player => player.player_id === a);
const playerB = players.find(player => player.player_id === b);

playerA.player_id;
playerB.player_id;
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.