title: Quick way to extend a set if we know elements are unique
body: <p>I am performing multiple iterations of the type:</p>
  
  <pre><code>masterSet=masterSet.union(setA)
  </code></pre>
  
  <p>As the set grows the length of time taken to perform these operations is growing (as one would expect, I guess).</p>
  
  <p>I expect that the time is taken up checking whether each element of setA is already in masterSet?</p>
  
  <p>My question is that if i KNOW that masterSet does not already contain any of elements in setA can I do this quicker? </p>
  
  <p>[UPDATE]</p>
  
  <p>Given that this question is still attracting views I thought I would clear up a few of the things from the comments and answers below: </p>
  
  <p>When iterating though there were many iterations where I <strong>knew</strong> <code>setA</code> would be distinct from <code>masterSet</code> because of how it was constructed (without having to process any checks) but a few iterations I needed the uniqueness check.</p>
  
  <p>I wondered if there was a way to 'tell' the <code>masterSet.union()</code> procedure not to bother with the uniquness check this time around as I know this one is distinct from <code>masterSet</code> just add these elements quickly trusting the programmer's assertion they were definately distict. Perhpas through calling some different "<code>.unionWithDistinctSet()</code>" procedure or something. </p>
  
  <p>I think the responses have suggested that this isnt possible (and that really set operations should be quick enough anyway) but to use <code>masterSet.update(setA)</code> instead of union as its slightly quicker still. </p>
  
  <p>I have accepted the clearest reponse along those lines, resolved the issue I was having at the time and got on with my life but would still love to hear if my hypothesised <code>.unionWithDistinctSet()</code> could ever exist?</p>