title: Performance cost of adding to the String prototype in javascript
body: <p>I was looking at some code (<a href="https://github.com/einaros/tinycolor/blob/master/tinycolor.js" rel="nofollow">https://github.com/einaros/tinycolor/blob/master/tinycolor.js</a>) that adds to the prototype of the <code>String</code> object in javascript. </p>
  
  <p>I was wondering how to assume the overhead of adding to the <code>String</code> prototype, as it applies to any string handling (cpu, memory) that doesn't require these additions. That's because I probably wouldn't find it useful to get overhead for all string manipulations just for this small shim, and I guess it's also a good time to get more friendly with javascript prototype manipulation of the native types. </p>
  
  <p>As the topic has been endlessly discussed in various contexts, any pointer to an existing good or simple analysis would be helpful, or a succinct-yet-correct explanation. It's a bit hard to land using a Google keyword search..</p>
  
  <p>Thanks!</p>