Skip to content

Instantly share code, notes, and snippets.

@shisama
Last active December 16, 2019 16:31
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/3152c82a7444f1eb8902b05ee025acd4 to your computer and use it in GitHub Desktop.
Save shisama/3152c82a7444f1eb8902b05ee025acd4 to your computer and use it in GitHub Desktop.
const start = performance.now();
interface Member {
name: string;
birthday: Date;
url: string;
instrument: string;
}
const john: Member = {
name: 'John Lennon',
birthday: new Date('1940-‎10-09'),
url: 'www.johnlennon.com',
instrument: '',
};
const paul: Member = {
name: 'Paul McCartney',
birthday: new Date('1942-06-18'),
url: 'https://www.paulmccartney.com/',
instrument: 'bass',
};
const george: Member = {
name: 'George Harrison',
birthday: new Date('1943-02-25'),
url: 'http://www.georgeharrison.com/',
instrument: 'guitar',
};
const ringo: Member = {
name: 'Ringo Starr',
birthday: new Date('1940-07-07'),
url: 'http://www.ringostarr.com/',
instrument: 'Drums',
};
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
// 1275.9350000414997
// 1279.7900000587106
// 1277.959999977611
// Firefox 69
// 47372
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment