title: should we choose async await over Promise in Javascript
body: <p>I know that the <code>async await</code> is the new <code>Promise</code> in the town and it is a new way to write asynchronous code and I also know that</p>
  
  <p>We didn’t have to write <code>.then</code>, create an anonymous function to handle the response</p>
  
  <p><code>Async/await</code> makes it finally possible to handle both synchronous and asynchronous errors with the same construct, good old try/catch</p>
  
  <p>The error stack returned from a <code>promise</code> chain gives no clue of where the error happened. However, the error stack from async/await points to the function that contains the error</p>
  
  <p>AND SO ON...</p>
  
  <p>but 
  here I have done a simple bench mark <a href="https://repl.it/repls/FormalAbandonedChimpanzee" rel="noreferrer">https://repl.it/repls/FormalAbandonedChimpanzee</a></p>
  
  <p>In the benchmark I have run 2 loops for 1 million times.
  In first loop I am calling a function that is returning 1
  in another function I am calling a function that is throwing 1 as an exception.</p>
  
  <p>the time taken by first loop which is calling a function that is returning 1 is almost half of the function that is throwing 1 as error.</p>
  
  <p>Which shows that time taken by <code>throw</code> is almost double of the time taken by <code>return</code></p>
  
  <pre><code>node v7.4 linux/amd64
  
  return takes 1.233seconds
  1000000
  throw takes 2.128seconds
  1000000
  </code></pre>
  
  <p><strong>Benchmark Code Below</strong></p>
  
  <pre><code>function f1() {
    return 1;
  }
  
  function f2() {
    throw 1;
  }
  
  function parseHrtimeToSeconds(hrtime) {
      var seconds = (hrtime[0] + (hrtime[1] / 1e9)).toFixed(3);
      return seconds;
  }
  
  var sum = 0;
  var start = 0;
  var i = 0;
  
  start = process.hrtime();
  for (i = 0; i &lt; 1e6; i++) {
    try {
      sum += f1();
    } catch (e) {
      sum += e;
    }
  }
  var seconds = parseHrtimeToSeconds(process.hrtime(start));
  console.log('return takes ' + seconds + 'seconds');
  console.log(sum);
  
  
  
  
  sum = 0;
  start = process.hrtime();
  for (i = 0; i &lt; 1e6; i++) {
    try {
      sum += f2();
    } catch (e) {
      sum += e;
    }
  }
  
  seconds = parseHrtimeToSeconds(process.hrtime(start));
  console.log('throw takes ' + seconds + 'seconds');
  console.log(sum);
  </code></pre>