Skip to content

Instantly share code, notes, and snippets.

View dtothefp's full-sized avatar

David Fox-Powell dtothefp

  • Flexport
  • United States
View GitHub Profile
@dtothefp
dtothefp / perf.js
Last active September 5, 2016 14:32
// gulp/tasks/perf.js
import {task as perfTask} from '@hfa/perf'
export default perfTask(/* any options */)
// perf.config.js
export default {
name: string // SpeedCurve project name
page: string // Page to test
env: string // "dev" or "prod"
gen @hfa/perf # generate a perf.config.js file in project root
@hfa/perf --page /bleep # run SpeedCurve tests against /bleep route for your project
@hfa/perf --env dev --page * # run SpeedCurve tests for all pages on "dev"
@hfa/perf --env prod --page * # run SpeedCurve tests for all pages on "prod"
import path from 'path';
import glob from 'globby';
import {readJson, outputJson} from 'fs-extra';
const cwd = process.cwd();
const read = (fp) => {
return new Promise((res, rej) => {
readJson(fp, (err, data) => {
if (err) return rej(err);
const flatten = (() => {
function flatten(arr, list) {
if (Array.isArray(arr)) {
arr.forEach(item => flatten(item, list))
} else {
list.push(arr)
}
return list
}
// function run(gen) {
// const it = gen()
// return new Promise((res, rej) => {
// function next(err, data) {
// let nextData;
// if (err !== undefined && err !== null) {
// nextData = it.throw(err)
// } else {
# i-27794fa1
https://docs.google.com/a/hillaryclinton.com/document/d/1Ofo4XOQAoKZozq9yS3p62xmh-kf18d0HVITVwn_jys8/edit?usp=sharing
---------------4 workers on 4 cores-----------------------
▶ wrk -c 50 -t 2 -d 1m -R 50 http://10.4.111.156/
Running 1m test @ http://10.4.111.156/
2 threads and 50 connections
Thread calibration: mean lat.: 5535.371ms, rate sampling interval: 12836ms
Thread calibration: mean lat.: 5376.000ms, rate sampling interval: 19415ms
Mocha {
files: [ '/Users/davidfox-powell/dev/sos-server/test/unit/server-middleware-spec.js' ],
options: { reporterOptions: {}, globals: [] },
suite:
Suite {
title: '',
ctx: {},
suites: [],
tests: [],
pending: false,
Mocha {
files: [ '/Users/davidfox-powell/dev/sos-server/test/unit/server-middleware-spec.js' ],
options: { reporterOptions: {}, globals: [] },
suite:
Suite {
title: '',
ctx: {},
suites: [],
tests: [],
pending: false,
import {isJSON} from '../utils/is-json';
import request from './superagent';
export async function({method = 'GET', url}) {
method = method.toUpperCase();
const methods = ['GET', 'POST'];
let [foundMethod] = methods.filter(m => method === m);
if (!foundMethod) {
throw new Error('you specified an unknown method')
import reactor from '../modules/bootstrap';
import serverMod from '@hfa/sos-server/lib/modules/server';
import formMetaMod from '../modules/form-meta';
import {Getters as FormGetters, makeActions as makeFormActions} from '@hfa/form-components';
import {analytics} from '../config';
import {isFunction} from '../utils/lodash';
class BootStrap {
constructor() {
const {_reactor = '{}'} = global.hfaGlobals || {};