Skip to content

Instantly share code, notes, and snippets.

@scaleflake
Created September 22, 2018 16:20
Show Gist options
  • Save scaleflake/7d621c7fd9499605f3661d1e11f4c028 to your computer and use it in GitHub Desktop.
Save scaleflake/7d621c7fd9499605f3661d1e11f4c028 to your computer and use it in GitHub Desktop.
/* jshint esversion: 6*/
/* jshint ignore:start */
let TIMES = 1000 * 1000 * 100;
console.time("(() => { }) instanceof Function");
for (let i = 0; i < TIMES; i++)
(() => {}) instanceof Function;
console.timeEnd("(() => { }) instanceof Function");
console.time("(async () => { }) instanceof Function");
for (let i = 0; i < TIMES; i++)
(async() => {}) instanceof Function;
console.timeEnd("(async () => { }) instanceof Function");
console.time("(function () { }) instanceof Function");
for (let i = 0; i < TIMES; i++)
(function() {}) instanceof Function
console.timeEnd("(function () { }) instanceof Function");
console.time("(async function () { }) instanceof Function");
for (let i = 0; i < TIMES; i++)
(async function() {}) instanceof Function
console.timeEnd("(async function () { }) instanceof Function");
console.log();
console.time("typeof (() => { }) === 'function'");
for (let i = 0; i < TIMES; i++)
typeof(() => {}) === 'function';
console.timeEnd("typeof (() => { }) === 'function'");
console.time("typeof (async () => { }) === 'function'");
for (let i = 0; i < TIMES; i++)
typeof(async() => {}) === 'function';
console.timeEnd("typeof (async () => { }) === 'function'");
console.time("typeof (function () { }) === 'function'");
for (let i = 0; i < TIMES; i++)
typeof(function() {}) === 'function';
console.timeEnd("typeof (function () { }) === 'function'");
console.time("typeof (async function () { }) === 'function'");
for (let i = 0; i < TIMES; i++)
typeof(async function() {}) === 'function';
console.timeEnd("typeof (async function () { }) === 'function'");
console.log();
console.time('(() => {}).__proto__ === Function.prototype');
for (let i = 0; i < TIMES; i++)
(() => {}).__proto__ === Function.prototype;
console.timeEnd('(() => {}).__proto__ === Function.prototype');
console.time('(async () => {}).__proto__ === Function.prototype');
for (let i = 0; i < TIMES; i++)
(async () => {}).__proto__ === Function.prototype;
console.timeEnd('(async () => {}).__proto__ === Function.prototype');
console.time('(function() {}).__proto__ === Function.prototype');
for (let i = 0; i < TIMES; i++)
(function() {}).__proto__ === Function.prototype;
console.timeEnd('(function() {}).__proto__ === Function.prototype');
console.time('(async function() {}).__proto__ === Function.prototype');
for (let i = 0; i < TIMES; i++)
(async function() {}).__proto__ === Function.prototype;
console.timeEnd('(async function() {}).__proto__ === Function.prototype');
/* jshint ignore:end */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment