title: Faster alternative to Containers.map?
body: <p>This question is related to: <a href="https://stackoverflow.com/questions/33635951/matlab-dynamically-storing-objects-alternatives-to-containers-map-class">Matlab: dynamically storing objects, alternatives to containers.Map class</a></p>
  
  <p>I'm building a data structure that needs to have key-value functionality, where the key is an int and the value is an object. And also needs to be able to dinamically add elements to this key-value map.</p>
  
  <p>So, Containers.map would a good option, but it is extremely slow (I have measured retrieval of values on a map of ~450 elements to be around 0.1s on my Linux machine). That's really strange, as I thought that they would implement this class as a hashmap or something like that.</p>
  
  <p>I need something a lot faster. I'm thinking on implementing myself a balanced binary search tree or something like that, but I don't know if this kind if dynamic recursive object would be fast on MATLAB (probably not).</p>
  
  <p>Is it possible to bind std::map into my application, or something else, that is faster than Containers.map?</p>
  
  <p>Edit, clarifications and code sample:
  I'm running this on a Matlab 2015a on linux. Here's a reproduction of the bad performance. In this program, the performance is not as bad because on my program I have a much more complex class hierarchy which generates a lot of overhead (the simple act of having a for to iterate for each element of the map and simply retrieve it takes almost 1 minute when there was ~450 elements). Here, I created a very simple graph class to illustrate the problem. pastebin.com/TvyzJxgK</p>