Skip to content

Instantly share code, notes, and snippets.

@shisama
Last active December 16, 2019 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shisama/686434d41ea77bdda11cea2a6c441681 to your computer and use it in GitHub Desktop.
Save shisama/686434d41ea77bdda11cea2a6c441681 to your computer and use it in GitHub Desktop.
const start = performance.now();
interface Member {
name: string;
birthday: Date | null;
url: string | null;
instrument: string | null;
}
const john: Member = {
name: 'John Lennon',
url: 'www.johnlennon.com',
birthday: null,
instrument: null,
};
const paul: Member = {
name: 'Paul McCartney',
birthday: new Date('1942-06-18'),
url: null,
instrument: null,
};
const george: Member = {
name: 'George Harrison',
url: null,
instrument: 'guitar',
birthday: null,
};
const ringo: Member = {
name: 'Ringo Starr',
birthday: null,
url: null,
instrument: null,
};
const beatles = [john, paul, george, ringo];
for (var i = 0; i < 1000 * 1000 * 1000; i++) {
beatles[i & 3].name;
}
const end = performance.now();
console.log(end - start);
// V8 7.9.317.31
// 1475.5349999666214
// 1462.2949999719858
// 1462.2949999719858
// Firefox 69
// 45857
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment