this is a short paragraph
Testing powered by:
function performanceTests(...testCases) { | |
const NUM_ITERATIONS = 5000000 | |
let results = [] | |
console.log(' -- Running tests... ') | |
for (let i=0, l=testCases.length; i<l; i+=1) { | |
results.push(testCases[i](NUM_ITERATIONS)) | |
} |
//First attempt: O(r^2) | |
function drawCircle(cx, cy, r) { | |
var dim = 100 | |
for (let i = -r; i<=r; i+=1) { | |
for (let j = -r; j<=r; j+=1) { | |
if ( | |
Math.round(Math.sqrt(i*i + j*j)) === r |
// Depends on d3.js. | |
// See https://gist.github.com/mbostock/4163057 | |
// Sample the SVG path uniformly with the specified precision. | |
function samples(path, precision) { | |
var n = path.getTotalLength(), t = [0], i = 0, dt = precision; | |
while ((i += dt) < n) t.push(i); | |
t.push(n); | |
return t.map(function(t) { | |
var p = path.getPointAtLength(t), a = [p.x, p.y]; |
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.famous = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | |
/** | |
* The MIT License (MIT) | |
* | |
* Copyright (c) 2015 Famous Industries Inc. | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this soft |
// This event emitter emits events, but reserves the right to publish events to | |
// for its creator. It uses a WeakMap for true encapsulation. | |
const eesToEventMaps = new WeakMap(); | |
export default class EventEmitter { | |
constructor(publisher) { | |
const eventMap = Object.create(null); | |
eesToEventMaps.set(this, eventMap); |
let propCacheSymbol = Symbol() | |
class MultiClassPrototype { | |
constructor(propCache) { | |
this[propCacheSymbol] = propCache | |
} | |
} | |
// Just an idea: multiple inheritance... | |
// IMPORTANT NOTE: This assumes that the prototype of the classes are not |
function multiple(...classes) { | |
// If more than one class extends from a native class, we may need to throw | |
// an error, since we can't mix native prototypes; We won't throw if the | |
// native prototypes of one class or in the same chain as the native | |
// prototypes in the others. For example, if one class extends from Array | |
// and another from Event, we'll throw an error because we can't put the | |
// Array prototype before the Event prototype or vice versa | |
// (`Array.prototype` and `Event.prototype` are `{enumerable:false, | |
// writable:false, configurable:false}`, so we can't change the __proto__ of |
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.infamous=e():t.infamous=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){n(1),t.exports=n(292)},function(t,e,n){(function(t){"use strict";function e(t,e,n){t[e]||Object[r](t,e,{writable:!0,configurable:!0,value:n})}if(n(2),n(287),n(289),t._babelPolyfill)throw new Error("only one instance of babel-polyfill is allowed");t._babelPolyfill=!0;var r="defineProperty";e(String.prototype,"padLeft","".padStart),e(String.prototype,"padRight","".padEnd),"pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach(funct |
/* | |
* Test 1 - for..in with hasOwnProperty check. | |
*/ | |
var counter = 0 | |
var i | |
var p | |
var start = performance.now() | |
for (i=0; i<1000; i+=1) { | |
for (p in window) { | |
if (window.hasOwnProperty(p)) {} |