Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36
Chrome 116
Linux
Desktop
one year ago
Test name Executions per second
async await 1752023.9 Ops/sec
old way 1178758.4 Ops/sec
Tests:
  • async await

    x
     
    const c = async () => {
        let temp = 3
        throw temp
    }
    const b = async () => {
      let temp = 2
      return temp
    }
    const a = async () => {
        let temp = 1
        temp = await b().catch(e => { throw e })
        temp = await c().catch(e => { throw e })
        return temp
    }
    a().catch(e => {})
  • old way

     
    const c = () => {
        let temp = 3
        throw temp
    }
    const b = () => {
      let temp = 2
      return temp
    }
    const a = () => {
        let temp = 1
        try {
          temp = b()
        } catch (e) {
          throw e
        }
        try {
          temp = c()
        } catch (e) {
          throw e
        }
        return temp
    }
    try {
      a()
    } catch (e) {
    }