Skip to content

Commit

Permalink
Restored anonymous functions over arrow functions. Restore 'use strict'.
Browse files Browse the repository at this point in the history
  • Loading branch information
aichholzer committed Sep 20, 2017
1 parent ae2b058 commit 0f51ac4
Show file tree
Hide file tree
Showing 15 changed files with 37 additions and 12 deletions.
1 change: 1 addition & 0 deletions benchmark-bench.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env node
'use strict'

const inquirer = require('inquirer')
const bench = require('./lib/bench')
Expand Down
4 changes: 3 additions & 1 deletion benchmarks/bare.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const server = require('http').createServer((req, res) => {
'use strict'

const server = require('http').createServer(function (req, res) {
res.setHeader('Content-Type', 'application/json')
res.end(JSON.stringify({ hello: 'world' }))
})
Expand Down
4 changes: 3 additions & 1 deletion benchmarks/connect-router.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
'use strict'

const connect = require('connect')
const router = require('router')()

const app = connect()
router.get('/', (req, res) => {
router.get('/', function (req, res) {
res.setHeader('Content-Type', 'application/json')
res.end(JSON.stringify({ hello: 'world' }))
})
Expand Down
4 changes: 3 additions & 1 deletion benchmarks/connect.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
'use strict'

const connect = require('connect')

const app = connect()
app.use((req, res) => {
app.use(function (req, res) {
res.setHeader('Content-Type', 'application/json')
res.end(JSON.stringify({ hello: 'world' }))
})
Expand Down
2 changes: 2 additions & 0 deletions benchmarks/express-route-prefix.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const express = require('express')

const app = express()
Expand Down
4 changes: 3 additions & 1 deletion benchmarks/express-with-middlewares.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const express = require('express')

const app = express()
Expand All @@ -13,7 +15,7 @@ app.use(require('hsts')())
app.use(require('ienoopen')())
app.use(require('x-xss-protection')())

app.get('/', (req, res) => {
app.get('/', function (req, res) {
res.json({ hello: 'world' })
})

Expand Down
4 changes: 3 additions & 1 deletion benchmarks/express.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
'use strict'

const express = require('express')

const app = express()

app.disable('etag')
app.disable('x-powered-by')

app.get('/', (req, res) => {
app.get('/', function (req, res) {
res.json({ hello: 'world' })
})

Expand Down
4 changes: 3 additions & 1 deletion benchmarks/fastify-big-json.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const fastify = require('fastify')()

const opts = {
Expand All @@ -24,7 +26,7 @@ function Employee ({ id = null, title = null, employer = null } = {}) {
this.employer = employer
}

fastify.get('/', opts, (request, reply) => {
fastify.get('/', opts, function (request, reply) {
const jobs = []

for (let i = 0; i < 200; i += 1) {
Expand Down
5 changes: 2 additions & 3 deletions benchmarks/fastify.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ const schema = {
}
}

fastify.get('/', schema, (req, reply) => {
reply
.send({ hello: 'world' })
fastify.get('/', schema, function (req, reply) {
reply.send({ hello: 'world' })
})

fastify.listen(3000)
4 changes: 3 additions & 1 deletion benchmarks/hapi.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const Hapi = require('hapi')

// Create a server with a host and port
Expand All @@ -21,7 +23,7 @@ server.route({
ranges: false
}
},
handler (request, reply) {
handler: function (request, reply) {
return reply({ hello: 'world' })
}
})
Expand Down
2 changes: 2 additions & 0 deletions benchmarks/koa-router.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const Koa = require('koa')
const router = require('koa-router')()

Expand Down
2 changes: 2 additions & 0 deletions benchmarks/koa.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const Koa = require('koa')

const app = new Koa()
Expand Down
2 changes: 2 additions & 0 deletions benchmarks/total.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const total = require('total.js')

total.http('release', {
Expand Down
2 changes: 2 additions & 0 deletions lib/autocannon.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const autocannon = require('autocannon')
const fs = require('fs')
const compare = require('autocannon-compare')
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
"main": "index.js",
"scripts": {
"start": "node benchmark.js",
"test": "./node_modules/.bin/standard | ./node_modules/.bin/snazzy",
"standard": "./node_modules/.bin/standard | ./node_modules/.bin/snazzy"
"compare": "node benchmark.js compare",
"test": "standard | snazzy",
"standard": "standard | snazzy"
},
"bin": {
"benchmark": "./benchmark.js"
Expand Down

0 comments on commit 0f51ac4

Please sign in to comment.