Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
use unordered_map instead of map for sake of speed
authorMartin Quinson <martin.quinson@loria.fr>
Thu, 26 May 2016 22:22:05 +0000 (00:22 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Thu, 26 May 2016 22:26:30 +0000 (00:26 +0200)
an also hopefully to avoid a FTBFS on travis:

/home/travis/build/simgrid/simgrid/src/smpi/private.hpp:13:36: error:
  wrong number of template arguments (2, should be 4)

/usr/include/boost/detail/container_fwd.hpp:132:73: error: provided
  for ‘template<class Key, class T, class Compare, class Allocator>
  class std::map’

examples/s4u/io/s4u_io.cpp
src/smpi/private.hpp
src/smpi/smpi_bench.cpp
src/smpi/smpi_global.cpp
src/surf/plugins/energy.hpp
src/surf/surf_routing.hpp

index b5a06a9..4ebaea7 100644 (file)
@@ -3,7 +3,6 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include <map>
 #include <unordered_map>
 #include <vector>
 
 #include <unordered_map>
 #include <vector>
 
index 6d3e172..5323374 100644 (file)
@@ -6,6 +6,7 @@
 #ifndef SMPI_PRIVATE_HPP
 #define SMPI_PRIVATE_HPP
 
 #ifndef SMPI_PRIVATE_HPP
 #define SMPI_PRIVATE_HPP
 
+#include <unordered_map>
 #include "src/instr/instr_smpi.h"
 
 #ifdef HAVE_PAPI
 #include "src/instr/instr_smpi.h"
 
 #ifdef HAVE_PAPI
@@ -15,7 +16,7 @@ XBT_PRIVATE papi_counter_t& smpi_process_counter_data(void);
 XBT_PRIVATE int smpi_process_event_set(void);
 #endif
 
 XBT_PRIVATE int smpi_process_event_set(void);
 #endif
 
-extern std::map<std::string, double> location2speedup;
+extern std::unordered_map<std::string, double> location2speedup;
 
 /** @brief Returns the last call location (filename, linenumber). Process-specific. */
 XBT_PUBLIC(smpi_trace_call_location_t*) smpi_process_get_call_location(void);
 
 /** @brief Returns the last call location (filename, linenumber). Process-specific. */
 XBT_PUBLIC(smpi_trace_call_location_t*) smpi_process_get_call_location(void);
index 891b663..31dce5b 100644 (file)
@@ -266,9 +266,9 @@ void smpi_bench_end(void)
   if (xbt_cfg_get_string("smpi/comp-adjustment-file")[0] != '\0') { // Maybe we need to artificially speed up or slow
                                                          // down our computation based on our statistical analysis.
 
   if (xbt_cfg_get_string("smpi/comp-adjustment-file")[0] != '\0') { // Maybe we need to artificially speed up or slow
                                                          // down our computation based on our statistical analysis.
 
-    smpi_trace_call_location_t* loc                  = smpi_process_get_call_location();
-    std::string key                                  = loc->get_composed_key();
-    std::map<std::string, double>::const_iterator it = location2speedup.find(key);
+    smpi_trace_call_location_t* loc                            = smpi_process_get_call_location();
+    std::string key                                            = loc->get_composed_key();
+    std::unordered_map<std::string, double>::const_iterator it = location2speedup.find(key);
     if (it != location2speedup.end()) {
       speedup = it->second;
     }
     if (it != location2speedup.end()) {
       speedup = it->second;
     }
index 2dd5af6..33b69b5 100644 (file)
@@ -28,7 +28,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_kernel, smpi, "Logging specific to SMPI (ke
 #include <boost/tokenizer.hpp>
 #include <boost/algorithm/string.hpp> /* trim_right / trim_left */
 
 #include <boost/tokenizer.hpp>
 #include <boost/algorithm/string.hpp> /* trim_right / trim_left */
 
-std::map<std::string, double> location2speedup;
+std::unordered_map<std::string, double> location2speedup;
 
 typedef struct s_smpi_process_data {
   double simulated;
 
 typedef struct s_smpi_process_data {
   double simulated;
index b854921..59db005 100644 (file)
@@ -8,7 +8,7 @@
 
 #include <xbt/base.h>
 
 
 #include <xbt/base.h>
 
-#include <map>
+#include <utility>
 
 #include "src/surf/HostImpl.hpp"
 
 
 #include "src/surf/HostImpl.hpp"
 
index bf34da1..e48ee7b 100644 (file)
@@ -16,7 +16,6 @@
 
 #include <float.h>
 #include <vector>
 
 #include <float.h>
 #include <vector>
-#include <map>
 
 SG_BEGIN_DECL()
 XBT_PUBLIC(void) routing_model_create(Link *loopback);
 
 SG_BEGIN_DECL()
 XBT_PUBLIC(void) routing_model_create(Link *loopback);