title: Boost flyweight for short strings
body: <p>I am implementing a system that stores and manipulates a lot of repetitive short strings. For example stock price series. I will have a lot of repetitive entries of Microsoft stock prices: </p>
  
  <pre><code>&lt;time1&gt;,MSFT,60.01
  &lt;time2&gt;,MSFT,60.02
  &lt;time3&gt;,MSFT,60.00
  </code></pre>
  
  <p>I am thinking of using <code>Boost::Flyweight</code> to optimize the memory allocation, string lookup/comparison/copying cost of those small repetitive ticker names (like MSFT in this case). </p>
  
  <p>But the thing is those strings are pretty small to begin with -- usually just a few bytes. While a long type is 8 bytes already in modern computers. Is it worth it to use <code>Boost::Flyweight</code> in this case?</p>
  
  <p>My understanding of <code>Boost::Flyweight</code> is that it internalized strings are integers to improve performance. But I think lookup/comparison/copying a 8-byte string wouldn't be dramatically different from operating on a 8-byte long datatype. So is it worth the hassel of moving to <code>Boost::Flyweight</code> ?</p>
  
  <p>My main goal is more on the speed optimization side as opposed to memory optimization side, if I have to choose one. </p>