Skip to content

Instantly share code, notes, and snippets.

@YassineBajdou
Created August 1, 2018 07:59
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 YassineBajdou/0ed5c5e1feba9c85fa6eeb3310f1a7a7 to your computer and use it in GitHub Desktop.
Save YassineBajdou/0ed5c5e1feba9c85fa6eeb3310f1a7a7 to your computer and use it in GitHub Desktop.
(() => {
const han = {firstname: "Han", lastname: "Solo"};
const luke = {firstname: "Luke", lastname: "Skywalker"};
const leia = {firstname: "Leia", lastname: "Organa"};
const obi = {firstname: "Obi", lastname: "Wan"};
const yoda = {firstname: "", lastname: "Yoda"};
const people = [
han, luke, leia, obi,
yoda, luke, leia, obi
];
const getName = (person) => person.lastname;
console.time("engine");
for(var i = 0; i < 1000 * 1000 * 1000; i++) {
getName(people[i & 7]);
}
console.timeEnd("engine");
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment