{"id":170311,"date":"2013-02-22T08:21:03","date_gmt":"2013-02-22T04:21:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=170311"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=170311","title":{"rendered":"<span class=\"post_title\">\u0411\u044b\u0441\u0442\u0440\u0430\u044f \u043a\u043e\u043d\u043a\u0430\u0442\u0435\u043d\u0430\u0446\u0438\u044f \u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 map<\/span>"},"content":{"rendered":"<div class=\"content html_format\">\n<h5>\u041e \u0447\u0435\u043c \u044d\u0442\u043e \u044f?<\/h5>\n<p>  \u0414\u043e\u0431\u0440\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u0443\u0442\u043e\u043a, \u0445\u0430\u0431\u0440\u0430\u0436\u0438\u0442\u0435\u043b\u0438!<br \/>  \u041f\u043e \u0434\u043e\u043b\u0433\u0443 \u0441\u043b\u0443\u0436\u0431\u044b \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u043a\u044d\u0448 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0441 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435\u043c \u0435\u0433\u043e \u0432 \u0411\u0414. \u0412\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432\u0441\u0442\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u043e \u0432\u044b\u0431\u043e\u0440\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0438 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432. \u041c\u043e\u0436\u043d\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u044b\u0431\u043e\u0440\u043e\u043c \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432, \u043d\u043e \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0432\u0441\u0435 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435, \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u0431\u044b\u043b\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u043f\u0430\u0440\u043e\u0447\u043a\u0430 \u0442\u0435\u0441\u0442\u043e\u0432. \u0417\u0430\u0434\u0430\u0447\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0435 \u0441\u0442\u0430\u0432\u0438\u043b\u0430\u0441\u044c. \u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e\u0433\u043e \u0434\u0435\u043b\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c STLPort 5.2.1 \u0438 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u0441 \u043d\u0438\u043c boost 1.52.0, \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0432\u0441\u0435 \u043d\u0430 gcc 4.6 \u043f\u043e\u0434 \u041e\u0421 Ubuntu 12.04.2. \u0417\u0430\u0434\u0430\u0447\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0435 \u0441\u0442\u0430\u0432\u0438\u043b\u0430\u0441\u044c, \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h5>\u041a\u043e\u043d\u043a\u0430\u0442\u0435\u043d\u0430\u0446\u0438\u044f \u0441\u0442\u0440\u043e\u043a<\/h5>\n<p>  \u0414\u043b\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0443\u0436\u0434 \u043c\u043d\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u043a\u043e\u043d\u043a\u0430\u0442\u0435\u043d\u0430\u0446\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u0442\u0440\u043e\u043a. \u041f\u043e\u0433\u0443\u0433\u043b\u0438\u0432 \u043d\u0430 \u0442\u0435\u043c\u0443 \u043d\u0430\u0448\u0435\u043b \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0435\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u043d\u043e \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0431\u044b\u043b\u0438 \u0431\u0435\u0437 \u043e\u0446\u0435\u043d\u043a\u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438. \u0420\u0435\u0448\u0438\u043b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b:<br \/>   \u2014 \u0441\u0431\u043e\u0440 \u0441\u0442\u0440\u043e\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e std::ostringstream;<br \/>   \u2014 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e append-\u043c\u0435\u0442\u043e\u0434\u0430 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 std::string;<br \/>   \u2014 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e append-\u043c\u0435\u0442\u043e\u0434\u0430 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 std::string \u0441 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0430\u043c\u044f\u0442\u0438;<br \/>   \u2014 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0430\u043c\u043e\u043f\u0438\u0441\u043d\u043e\u0433\u043e StringBuilder, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 std::list \u0438 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0438\u0445 append-\u043e\u043c \u0441 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0430\u043c\u044f\u0442\u0438.<br \/>  StringBuilder \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"cpp\">class StringBuilder { private:     typedef std::list&lt; std::string &gt; StrList;  public:     StringBuilder() : m_nSize( 0 ) {}      ~StringBuilder() {}      inline void operator&lt;&lt;( const std::string& s )     {         m_List.push_back( s );         m_nSize += s.size();     }      inline const std::string& GetResult()     {         if( m_sResult.empty() )         {             m_sResult.reserve( m_nSize );              for( StrList::const_iterator it = m_List.begin(), end = m_List.end(); it != end; ++it )             {                 m_sResult.append( *it );             }         }          return m_sResult;     }  private:     StrList m_List;     std::string m_sResult;     size_t m_nSize; }; <\/code><\/pre>\n<p>  \u041f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0434\u043b\u0438\u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u043d\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432 \u043b\u0438\u0441\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a \u0438\u0434\u0435\u0442 \u0432 \u00ab\u043b\u0435\u043d\u0438\u0432\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435\u00bb. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u044f \u043c\u044b \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0434\u043b\u0438\u043d\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u0438. \u0412 \u0438\u0442\u043e\u0433\u0435 \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u043e\u0434 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u043f\u0430\u043c\u044f\u0442\u044c \u0438 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c \u0432\u0441\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u043d\u0435\u0435.<br \/>  \u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0432\u0441\u0435 \u044d\u0442\u043e \u0434\u0435\u043b\u043e \u0432\u043e\u0442 \u0442\u0430\u043a\u0438\u043c \u043a\u043e\u0434\u043e\u043c:<\/p>\n<pre><code class=\"cpp\">int main(int argc, char* argv[]) {     {         StringBuilder builder;         boost::posix_time::ptime time_start( boost::posix_time::microsec_clock::local_time() );          for( int i = 0; i &lt; 10000000; ++i )         {             builder &lt;&lt; &quot;adlkjeowihfxnnzdloifhoweisndlxkijnvosifs&quot;;         }          std::string s = builder.GetResult();         boost::posix_time::ptime time_end( boost::posix_time::microsec_clock::local_time() );         boost::posix_time::time_duration duration( time_end - time_start );          TRACE( &quot;Concatenation using StringBuilder duration: &quot; &lt;&lt; duration.total_microseconds() );         s.clear();     }      {         std::ostringstream stream;         boost::posix_time::ptime time_start( boost::posix_time::microsec_clock::local_time() );          for( int i = 0; i &lt; 10000000; ++i )         {             stream &lt;&lt; &quot;adlkjeowihfxnnzdloifhoweisndlxkijnvosifs&quot;;         }          std::string s = stream.str();         boost::posix_time::ptime time_end( boost::posix_time::microsec_clock::local_time() );         boost::posix_time::time_duration duration( time_end - time_start );          TRACE( &quot;Concatenation using ostringstream duration: &quot; &lt;&lt; duration.total_microseconds() );         s.clear();     }      size_t nSize;      {         std::string s;         boost::posix_time::ptime time_start( boost::posix_time::microsec_clock::local_time() );          for( int i = 0; i &lt; 10000000; ++i )         {             s.append( &quot;adlkjeowihfxnnzdloifhoweisndlxkijnvosifs&quot; );         }          boost::posix_time::ptime time_end( boost::posix_time::microsec_clock::local_time() );         boost::posix_time::time_duration duration( time_end - time_start );          TRACE( &quot;Concatenation using string append duration: &quot; &lt;&lt; duration.total_microseconds() );         nSize = s.size();         s.clear();     }      {         std::string s;         s.reserve( nSize );         boost::posix_time::ptime time_start( boost::posix_time::microsec_clock::local_time() );          for( int i = 0; i &lt; 10000000; ++i )         {             s.append( &quot;adlkjeowihfxnnzdloifhoweisndlxkijnvosifs&quot; );         }          boost::posix_time::ptime time_end( boost::posix_time::microsec_clock::local_time() );         boost::posix_time::time_duration duration( time_end - time_start );          TRACE( &quot;Concatenation using string append with reserve duration: &quot; &lt;&lt; duration.total_microseconds() );         s.clear();     }      return 0; } <\/code><\/pre>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435:<\/p>\n<p>  <b>Concatenation using StringBuilder duration: 1395687<br \/>  Concatenation using ostringstream duration: 1080554<br \/>  Concatenation using string append duration: 413750<br \/>  Concatenation using string append with reserve duration: 197131<\/b><\/p>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c, \u0447\u0442\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0430\u0442\u044c \u043d\u0435 \u043d\u0430\u0434\u043e, \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u0430\u043c\u044b\u0439 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 append, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c, \u043f\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c \u043f\u043e\u0434 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.  <\/p>\n<h5>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c map<\/h5>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u043f\u043e\u0434\u0432\u0435\u0440\u0433\u043b\u0438\u0441\u044c boost::unordered_map, std::hash_map \u0438 std::map.<br \/>  \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u043b\u0430\u0441\u044c \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c, \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u043b\u0438\u0441\u044c \u043f\u0430\u0440\u0430\u043c\u0438, \u043a\u043b\u044e\u0447\u043e\u043c \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u044b\u043b\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u043f\u043e 40 \u0431\u0430\u0439\u0442 \u0434\u043b\u0438\u043d\u043e\u0439, \u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0431\u044b\u043b 0. \u0412\u0441\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u2014 100 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432. \u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0432\u0441\u0435 \u0442\u044b\u0441\u044f\u0447\u0435\u0439 \u0432\u044b\u0431\u043e\u0440\u043e\u043a 100 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u0432\u0435\u0434\u043e\u043c\u043e \u0438\u043c\u0435\u043b\u0438\u0441\u044c \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435.<\/p>\n<pre><code class=\"cpp\">std::string GetRandomSHA1();  int main(int argc, char* argv[]) {     {         typedef boost::unordered_map&lt; std::string, int &gt; Str2IntMap;         Str2IntMap test_map;         typedef std::list&lt; std::string &gt; HashList;         HashList hash_list;          for( int i = 0; i &lt; 100000000; ++i )         {             std::string sSHA1 = GetRandomSHA1();             test_map[ sSHA1 ] = 0;              if( i &lt; 100 )             {                 hash_list.push_back( sSHA1 );             }         }          boost::posix_time::ptime time_start( boost::posix_time::microsec_clock::local_time() );          for( int i = 0; i &lt; 1000; ++i )         {             for( HashList::const_iterator it = hash_list.begin(), end = hash_list.end(); it != end; ++it )             {                 int n = test_map[ *it ];                 n = 0;             }         }          boost::posix_time::ptime time_end( boost::posix_time::microsec_clock::local_time() );         boost::posix_time::time_duration duration( time_end - time_start );          TRACE( &quot;unordered_map summary find element duration: &quot; &lt;&lt; duration.total_microseconds() );     }      {         typedef std::hash_map&lt; std::string, int &gt; Str2IntMap;         Str2IntMap test_map;         typedef std::list&lt; std::string &gt; HashList;         HashList hash_list;          for( int i = 0; i &lt; 100000000; ++i )         {             std::string sSHA1 = GetRandomSHA1();             test_map[ sSHA1 ] = 0;              if( i &lt; 100 )             {                 hash_list.push_back( sSHA1 );             }         }          boost::posix_time::ptime time_start( boost::posix_time::microsec_clock::local_time() );          for( int i = 0; i &lt; 1000; ++i )         {             for( HashList::const_iterator it = hash_list.begin(), end = hash_list.end(); it != end; ++it )             {                 int n = test_map[ *it ];                 n = 0;             }         }          boost::posix_time::ptime time_end( boost::posix_time::microsec_clock::local_time() );         boost::posix_time::time_duration duration( time_end - time_start );          TRACE( &quot;std::hash_map summary find element duration: &quot; &lt;&lt; duration.total_microseconds() );     }      {         typedef std::map&lt; std::string, int &gt; Str2IntMap;         Str2IntMap test_map;         typedef std::list&lt; std::string &gt; HashList;         HashList hash_list;          for( int i = 0; i &lt; 100000000; ++i )         {             std::string sSHA1 = GetRandomSHA1();             test_map[ sSHA1 ] = 0;              if( i &lt; 100 )             {                 hash_list.push_back( sSHA1 );             }         }          boost::posix_time::ptime time_start( boost::posix_time::microsec_clock::local_time() );          for( int i = 0; i &lt; 1000; ++i )         {             for( HashList::const_iterator it = hash_list.begin(), end = hash_list.end(); it != end; ++it )             {                 int n = test_map[ *it ];                 n = 0;             }         }          boost::posix_time::ptime time_end( boost::posix_time::microsec_clock::local_time() );         boost::posix_time::time_duration duration( time_end - time_start );          TRACE( &quot;std::map summary find element duration: &quot; &lt;&lt; duration.total_microseconds() );     }      return 0; }  std::string GetRandomSHA1() {     char szSha1[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };     char* szSha1Tmp = szSha1;     std::srand( std::time( 0 ) );      for( size_t i = 0; i &lt; 20; ++i )     {         unsigned int c = std::rand() % 255;         sprintf( szSha1Tmp, &quot;%02X&quot;, c );         szSha1Tmp += 2;     }      return szSha1; } <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0442\u0443\u0442 \u043d\u0430\u0447\u0430\u043b\u0438\u0441\u044c \u0441\u044e\u0440\u043f\u0440\u0438\u0437\u044b.<\/p>\n<p>  <b>unordered_map summary find element duration: 8154<br \/>  std::hash_map summary find element duration: 3494<br \/>  std::map summary find element duration: 6072<br \/>  <\/b><br \/>  \u041e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e boost::unordered_map \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435 \u0447\u0435\u043c std::map. \u041d\u0435 \u0437\u043d\u0430\u044e, \u0441 \u0447\u0435\u043c \u044d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e, \u043d\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u043b\u0441\u044f, \u043d\u043e \u0444\u0430\u043a\u0442 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0444\u0430\u043a\u0442\u043e\u043c.<br \/>  \u0410 \u0432\u043e\u0442 std::hash_map \u043a\u0430\u043a \u0440\u0430\u0437 \u043f\u043e\u043a\u0430\u0437\u0430\u043b \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b, \u043e\u043d \u043f\u043e\u0447\u0442\u0438 \u0432 \u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u0435\u0435 std::map. \u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u0432\u0435\u043b\u043e \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u044f \u0441\u043a\u0432\u043e\u0437\u043d\u043e\u0439 \u0437\u0430\u043c\u0435\u043d\u043e\u0439 \u0432\u043e \u0432\u0441\u0435\u043c \u043c\u043e\u0435\u043c \u043a\u043e\u0434\u0435 \u0437\u0430\u043c\u0435\u043d\u0438\u043b boost::unordred_map \u043d\u0430 std::hash_map. \u0412\u043e\u0442 \u0442\u0430\u043a\u0438\u0435 \u0434\u0435\u043b\u0430.    \t \t\t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/170311\/\"> http:\/\/habrahabr.ru\/post\/170311\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">\n<h5>\u041e \u0447\u0435\u043c \u044d\u0442\u043e \u044f?<\/h5>\n<p>  \u0414\u043e\u0431\u0440\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u0443\u0442\u043e\u043a, \u0445\u0430\u0431\u0440\u0430\u0436\u0438\u0442\u0435\u043b\u0438!<br \/>  \u041f\u043e \u0434\u043e\u043b\u0433\u0443 \u0441\u043b\u0443\u0436\u0431\u044b \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u043a\u044d\u0448 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0441 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435\u043c \u0435\u0433\u043e \u0432 \u0411\u0414. \u0412\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432\u0441\u0442\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u043e \u0432\u044b\u0431\u043e\u0440\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0438 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432. \u041c\u043e\u0436\u043d\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u044b\u0431\u043e\u0440\u043e\u043c \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432, \u043d\u043e \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0432\u0441\u0435 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435, \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u0431\u044b\u043b\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u043f\u0430\u0440\u043e\u0447\u043a\u0430 \u0442\u0435\u0441\u0442\u043e\u0432. \u0417\u0430\u0434\u0430\u0447\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0435 \u0441\u0442\u0430\u0432\u0438\u043b\u0430\u0441\u044c. \u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e\u0433\u043e \u0434\u0435\u043b\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c STLPort 5.2.1 \u0438 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u0441 \u043d\u0438\u043c boost 1.52.0, \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0432\u0441\u0435 \u043d\u0430 gcc 4.6 \u043f\u043e\u0434 \u041e\u0421 Ubuntu 12.04.2. \u0417\u0430\u0434\u0430\u0447\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0435 \u0441\u0442\u0430\u0432\u0438\u043b\u0430\u0441\u044c, \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-170311","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/170311","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=170311"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/170311\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=170311"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=170311"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=170311"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}