Skip to content

Commit

Permalink
chore: clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
willfarrell committed Dec 10, 2023
1 parent dd8d9ce commit 058181a
Show file tree
Hide file tree
Showing 21 changed files with 60 additions and 40 deletions.
5 changes: 3 additions & 2 deletions packages/appconfig/__benchmarks__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,14 @@ const setupHandler = (options = {}) => {
const coldHandler = setupHandler({ cacheExpiry: 0 })
const warmHandler = setupHandler()

const event = {}
await bench
.add('without cache', async (event = {}) => {
.add('without cache', async () => {
try {
await coldHandler(event, context)
} catch (e) {}
})
.add('with cache', async (event = {}) => {
.add('with cache', async () => {
try {
await warmHandler(event, context)
} catch (e) {}
Expand Down
5 changes: 3 additions & 2 deletions packages/cloudwatch-metrics/__benchmarks__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ const setupHandler = (options = {}) => {
const coldHandler = setupHandler({ cacheExpiry: 0 })
const warmHandler = setupHandler()

const event = {}
await bench
.add('without cache', async (event = {}) => {
.add('without cache', async () => {
try {
await coldHandler(event, context)
} catch (e) {}
})
.add('with cache', async (event = {}) => {
.add('with cache', async () => {
try {
await warmHandler(event, context)
} catch (e) {}
Expand Down
6 changes: 3 additions & 3 deletions packages/core/__benchmarks__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ await bench
.add('Warm Invocation', async () => {
await warmHandler(event, context)
})
// .add('Warm Invocation * next', async (event = {}) => {
// .add('Warm Invocation * next', async () => {
// await warmNextHandler(event, context)
// })
.add('Warm Async Invocation', async () => {
Expand All @@ -85,14 +85,14 @@ await bench
.add('Warm Invocation with disabled Timeout', async () => {
await warmDisableTimeoutHandler(event, context)
})
// .add('Warm Invocation with disabled Timeout * next', async (event = {}) => {
// .add('Warm Invocation with disabled Timeout * next', async () => {
// await warmNextTimeoutHandler(event, context)
// })
// TODO StreamifyResponse
.add('Warm Invocation with middleware', async () => {
await warmMiddlewareHandler(event, context)
})
// .add('Warm Invocation with middleware * next', async (event = {}) => {
// .add('Warm Invocation with middleware * next', async () => {
// await warmNextMiddlewareHandler(event, context)
// })
.add('Warm Invocation with async middleware', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ const setupHandler = () => {

const warmHandler = setupHandler()

const event = {}
await bench
.add('Change Context', async (event = {}) => {
.add('Change Context', async () => {
try {
await warmHandler(event, context)
} catch (e) {}
Expand Down
5 changes: 3 additions & 2 deletions packages/dynamodb/__benchmarks__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ const setupHandler = (options = {}) => {
const coldHandler = setupHandler({ cacheExpiry: 0 })
const warmHandler = setupHandler()

const event = {}
await bench
.add('without cache', async (event = {}) => {
.add('without cache', async () => {
try {
await coldHandler(event, context)
} catch (e) {}
})
.add('with cache', async (event = {}) => {
.add('with cache', async () => {
try {
await warmHandler(event, context)
} catch (e) {}
Expand Down
3 changes: 2 additions & 1 deletion packages/error-logger/__benchmarks__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ const setupHandler = () => {

const warmHandler = setupHandler()

const event = {}
await bench
.add('Catch Error', async (event = {}) => {
.add('Catch Error', async () => {
try {
await warmHandler(event, context)
} catch (e) {}
Expand Down
5 changes: 3 additions & 2 deletions packages/http-content-encoding/__benchmarks__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ const setupHandler = (options) => {
const gzHandler = setupHandler({ preferredEncoding: 'gz' })
const brHandler = setupHandler({ preferredEncoding: 'br' })

const event = {}
await bench
.add('gzip Response', async (event = {}) => {
.add('gzip Response', async () => {
try {
await gzHandler(event, context)
} catch (e) {}
})
.add('brotli Response', async (event = {}) => {
.add('brotli Response', async () => {
try {
await brHandler(event, context)
} catch (e) {}
Expand Down
3 changes: 2 additions & 1 deletion packages/http-error-handler/__benchmarks__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ const setupHandler = () => {

const warmHandler = setupHandler()

const event = {}
await bench
.add('Handle Error', async (event = {}) => {
.add('Handle Error', async () => {
try {
await warmHandler(event, context)
} catch (e) {}
Expand Down
3 changes: 2 additions & 1 deletion packages/http-event-normalizer/__benchmarks__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ const setupHandler = () => {

const warmHandler = setupHandler()

const event = {}
await bench
.add('Normalize Event', async (event = {}) => {
.add('Normalize Event', async () => {
try {
await warmHandler(event, context)
} catch (e) {}
Expand Down
3 changes: 2 additions & 1 deletion packages/http-response-serializer/__benchmarks__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ const setupHandler = () => {

const warmHandler = setupHandler()

const event = {}
await bench
.add('Serialize Response', async (event = {}) => {
.add('Serialize Response', async () => {
try {
await warmHandler(event, context)
} catch (e) {}
Expand Down
3 changes: 2 additions & 1 deletion packages/http-security-headers/__benchmarks__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ const setupHandler = () => {

const warmHandler = setupHandler()

const event = {}
await bench
.add('Add Headers', async (event = {}) => {
.add('Add Headers', async () => {
try {
await warmHandler(event, context)
} catch (e) {}
Expand Down
5 changes: 3 additions & 2 deletions packages/rds-signer/__benchmarks__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ const setupHandler = (options = {}) => {
const coldHandler = setupHandler({ cacheExpiry: 0 })
const warmHandler = setupHandler()

const event = {}
await bench
.add('without cache', async (event = {}) => {
.add('without cache', async () => {
try {
await coldHandler(event, context)
} catch (e) {}
})
.add('with cache', async (event = {}) => {
.add('with cache', async () => {
try {
await warmHandler(event, context)
} catch (e) {}
Expand Down
5 changes: 3 additions & 2 deletions packages/s3/__benchmarks__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ const setupHandler = (options = {}) => {
const coldHandler = setupHandler({ cacheExpiry: 0 })
const warmHandler = setupHandler()

const event = {}
await bench
.add('without cache', async (event = {}) => {
.add('without cache', async () => {
try {
await coldHandler(event, context)
} catch (e) {}
})
.add('with cache', async (event = {}) => {
.add('with cache', async () => {
try {
await warmHandler(event, context)
} catch (e) {}
Expand Down
5 changes: 3 additions & 2 deletions packages/secrets-manager/__benchmarks__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ const setupHandler = (options = {}) => {
const coldHandler = setupHandler({ cacheExpiry: 0 })
const warmHandler = setupHandler()

const event = {}
await bench
.add('without cache', async (event = {}) => {
.add('without cache', async () => {
try {
await coldHandler(event, context)
} catch (e) {}
})
.add('with cache', async (event = {}) => {
.add('with cache', async () => {
try {
await warmHandler(event, context)
} catch (e) {}
Expand Down
5 changes: 3 additions & 2 deletions packages/service-discovery/__benchmarks__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,14 @@ const setupHandler = (options = {}) => {
const coldHandler = setupHandler({ cacheExpiry: 0 })
const warmHandler = setupHandler()

const event = {}
await bench
.add('without cache', async (event = {}) => {
.add('without cache', async () => {
try {
await coldHandler(event, context)
} catch (e) {}
})
.add('with cache', async (event = {}) => {
.add('with cache', async () => {
try {
await warmHandler(event, context)
} catch (e) {}
Expand Down
10 changes: 6 additions & 4 deletions packages/sqs-partial-batch-failure/__benchmarks__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const context = {
}
const setupHandler = () => {
const baseHandler = (event) => {
const recordPromises = event.Records.map(async (record, index) => {
return record
const recordPromises = event.Records.map((record, index) => {
return Promise.resolve(record)
})
return Promise.allSettled(recordPromises)
}
Expand All @@ -19,13 +19,15 @@ const setupHandler = () => {

const warmHandler = setupHandler()

const event = {
Records: [{}]
}
await bench
.add('process failures', async (event = {}) => {
.add('process failures', async () => {
try {
await warmHandler(event, context)
} catch (e) {}
})

.run()

console.table(bench.table())
5 changes: 3 additions & 2 deletions packages/ssm/__benchmarks__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ const setupHandler = (options = {}) => {
const coldHandler = setupHandler({ cacheExpiry: 0 })
const warmHandler = setupHandler()

const event = {}
await bench
.add('without cache', async (event = {}) => {
.add('without cache', async () => {
try {
await coldHandler(event, context)
} catch (e) {}
})
.add('with cache', async (event = {}) => {
.add('with cache', async () => {
try {
await warmHandler(event, context)
} catch (e) {}
Expand Down
5 changes: 3 additions & 2 deletions packages/sts/__benchmarks__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ const setupHandler = (options = {}) => {
const coldHandler = setupHandler({ cacheExpiry: 0 })
const warmHandler = setupHandler()

const event = {}
await bench
.add('without cache', async (event = {}) => {
.add('without cache', async () => {
try {
await coldHandler(event, context)
} catch (e) {}
})
.add('with cache', async (event = {}) => {
.add('with cache', async () => {
try {
await warmHandler(event, context)
} catch (e) {}
Expand Down
8 changes: 4 additions & 4 deletions packages/util/__benchmarks__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ import {
const bench = new Bench({ time: 1_000 })

await bench
.add('getInternal', async (event = {}) => {
.add('getInternal', async () => {
await getInternal(true, {
internal: {
key: Promise.resolve('value')
}
})
})
.add('processCache', async (event = {}) => {
.add('processCache', async () => {
await processCache({ cacheExpiry: -1, cacheKey: 'key' })
})
.add('jsonSafeParse', async (event = {}) => {
.add('jsonSafeParse', async () => {
await jsonSafeParse('{"key":"value"}')
})
.add('normalizeHttpResponse', async (event = {}) => {
.add('normalizeHttpResponse', async () => {
await normalizeHttpResponse({})
})

Expand Down
3 changes: 2 additions & 1 deletion packages/validator/__benchmarks__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ const setupHandler = () => {

const warmHandler = setupHandler()

const event = {}
await bench
.add('type check input & output', async (event = {}) => {
.add('type check input & output', async () => {
try {
await warmHandler(event, context)
} catch (e) {}
Expand Down
5 changes: 3 additions & 2 deletions packages/ws-response/__benchmarks__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ const setupHandler = (options = {}) => {
const coldHandler = setupHandler({ cacheExpiry: 0 })
const warmHandler = setupHandler()

const event = {}
await bench
.add('without cache', async (event = {}) => {
.add('without cache', async () => {
try {
await coldHandler(event, context)
} catch (e) {}
})
.add('with cache', async (event = {}) => {
.add('with cache', async () => {
try {
await warmHandler(event, context)
} catch (e) {}
Expand Down

0 comments on commit 058181a

Please sign in to comment.