title: How important are data types to memory in Spark/Scala?
body: <p>As a general rule of thumb, how important is it to optimize when it comes to Spark Scala datatypes? I'm interesting in saving memory, but if there are other considerations, I'd be happy to hear them.</p>
  
  <p>Does Spark do any casting which would make, say, using a Short instead of an Int or Long superfluous? </p>
  
  <p>Or does it create multiple references which would makes these savings a small part of the memory usage of the application?</p>
  
  <p>If not, what about if I have a decimal value for which I need very little precision. Say three digits, from 0 to 1. I could use a Short to represent this (16 bits) instead of a Float (32 bits). Is this a reasonable optimization?</p>