repositories
/
benchmarks-js.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
build(deps-dev): apply updates
[benchmarks-js.git]
/
promise-handling.mjs
diff --git
a/promise-handling.mjs
b/promise-handling.mjs
index 97117f19d9a086733a9bad0b0d32d9097e850be9..1624bc2d18224946d95738bb0c2dac41109040bc 100644
(file)
--- a/
promise-handling.mjs
+++ b/
promise-handling.mjs
@@
-3,19
+3,12
@@
import Benchmark from 'benny'
/**
*
*/
/**
*
*/
-async function
promise
() {
-
return
await new Promise(resolve => {
+async function
asyncFunction
() {
+ await new Promise(resolve => {
resolve()
})
}
resolve()
})
}
-/**
- *
- */
-async function asyncFunction () {
- return await promise()
-}
-
Benchmark.suite(
'Promise handling',
Benchmark.add('await promise', async () => {
Benchmark.suite(
'Promise handling',
Benchmark.add('await promise', async () => {
@@
-30,9
+23,7
@@
Benchmark.suite(
.then(r => {
return r
})
.then(r => {
return r
})
- .catch(e => {
- console.error(e)
- })
+ .catch(console.error)
}),
Benchmark.add('voided promise', () => {
// eslint-disable-next-line no-void
}),
Benchmark.add('voided promise', () => {
// eslint-disable-next-line no-void
@@
-58,6
+49,4
@@
Benchmark.suite(
format: 'table.html',
details: true
})
format: 'table.html',
details: true
})
-).catch(err => {
- console.error(err)
-})
+).catch(console.error)