title: Which method performs fastest while adding an attribute in jQuery, using attr() method, passing attributes as a key-value object, or direct?
body: <p>I know three ways of adding a href attribute which contains a relative link in jQuery: using (1) .attr(), (2) attributes as key-value pair in an argument, or (3) direct writing (you might know other methods, please tell in your answer for me to learn).</p>
  
  <ol>
  <li>Using .attr()</li>
  </ol>
  
  <p>It will look something like below using this method.</p>
  
  <pre><code>var link = "relative-link.html";
  $("&lt;a/&gt;").attr("href",link);
  </code></pre>
  
  <ol start="2">
  <li>Using argument</li>
  </ol>
  
  <p>Like this:</p>
  
  <pre><code>var link = "relative-link.html";
  $("&lt;a/&gt;", {href: link});
  </code></pre>
  
  <ol start="3">
  <li>Direct</li>
  </ol>
  
  <p>Like this:</p>
  
  <pre><code>var link = "relative-link.html";
  $("&lt;a href=" + link + "&gt;");
  </code></pre>
  
  <p>So, which is faster performance wise among those method? Why I should choose one method over the others. Also consider adding other attributes such as <code>class</code> and which method should be preferred when adding multiple attributes in one go.</p>
  
  <p>Please tell me which method is better and in which case with proper reasoning. Thanks!</p>