proxygen
F14SmallOverheads.cpp File Reference
#include <functional>
#include <iostream>
#include <limits>
#include <memory>
#include <string>
#include <unordered_map>
#include <utility>
#include <folly/container/F14Map.h>

Go to the source code of this file.

Classes

struct  LoggingAlloc< T >
 
struct  LoggingAlloc< T >::rebind< U >
 

Typedefs

template<typename K , typename V , template< typename > class A>
using StdUnorderedMapTable = std::unordered_map< K, V, std::hash< K >, std::equal_to< K >, A< std::pair< K const, V >>>
 
template<typename K , typename V , template< typename > class A>
using F14ValueMapTable = F14ValueMap< K, V, std::hash< K >, std::equal_to< K >, A< std::pair< K const, V >>>
 
template<typename K , typename V , template< typename > class A>
using F14NodeMapTable = F14NodeMap< K, V, std::hash< K >, std::equal_to< K >, A< std::pair< K const, V >>>
 
template<typename K , typename V , template< typename > class A>
using F14VectorMapTable = F14VectorMap< K, V, std::hash< K >, std::equal_to< K >, A< std::pair< K const, V >>>
 

Functions

template<typename M >
void runSingleInsert (std::string const &name)
 
template<template< typename, typename, template< typename > class > class T>
void runSingleInserts (std::string const &name)
 
FOLLY_NOINLINE int codeSize_find_Std (std::unordered_map< int16_t, float > &m, int16_t k)
 
FOLLY_NOINLINE int codeSize_find_F14Value (F14ValueMap< int16_t, float > &m, int16_t k)
 
FOLLY_NOINLINE int codeSize_find_F14Node (F14NodeMap< int16_t, float > &m, int16_t k)
 
FOLLY_NOINLINE int codeSize_find_F14Vector (F14VectorMap< int16_t, float > &m, int16_t k)
 
FOLLY_NOINLINE void codeSize_bracket_Std (std::unordered_map< int16_t, uint32_t > &m, int16_t k, uint32_t v)
 
FOLLY_NOINLINE void codeSize_bracket_F14Value (F14ValueMap< int16_t, uint32_t > &m, int16_t k, uint32_t v)
 
FOLLY_NOINLINE void codeSize_bracket_F14Node (F14NodeMap< int16_t, uint32_t > &m, int16_t k, uint32_t v)
 
FOLLY_NOINLINE void codeSize_bracket_F14Vector (F14VectorMap< int16_t, uint32_t > &m, int16_t k, uint32_t v)
 
FOLLY_NOINLINE void codeSize_erase_Std (std::unordered_map< int16_t, uint32_t > &m, std::unordered_map< int16_t, uint32_t >::iterator iter)
 
FOLLY_NOINLINE void codeSize_erase_F14Value (F14ValueMap< int16_t, uint32_t > &m, F14ValueMap< int16_t, uint32_t >::iterator iter)
 
FOLLY_NOINLINE void codeSize_erase_F14Node (F14NodeMap< int16_t, uint32_t > &m, F14NodeMap< int16_t, uint32_t >::iterator iter)
 
FOLLY_NOINLINE void codeSize_erase_F14Vector (F14VectorMap< int16_t, uint32_t > &m, F14VectorMap< int16_t, uint32_t >::iterator iter)
 
int main (int, char **)
 

Typedef Documentation

template<typename K , typename V , template< typename > class A>
using F14NodeMapTable = F14NodeMap<K, V, std::hash<K>, std::equal_to<K>, A<std::pair<K const, V>>>

Definition at line 96 of file F14SmallOverheads.cpp.

template<typename K , typename V , template< typename > class A>
using F14ValueMapTable = F14ValueMap<K, V, std::hash<K>, std::equal_to<K>, A<std::pair<K const, V>>>

Definition at line 92 of file F14SmallOverheads.cpp.

template<typename K , typename V , template< typename > class A>
using F14VectorMapTable = F14VectorMap< K, V, std::hash<K>, std::equal_to<K>, A<std::pair<K const, V>>>

Definition at line 104 of file F14SmallOverheads.cpp.

template<typename K , typename V , template< typename > class A>
using StdUnorderedMapTable = std::unordered_map< K, V, std::hash<K>, std::equal_to<K>, A<std::pair<K const, V>>>

Definition at line 88 of file F14SmallOverheads.cpp.

Function Documentation

FOLLY_NOINLINE void codeSize_bracket_F14Node ( F14NodeMap< int16_t, uint32_t > &  m,
int16_t  k,
uint32_t  v 
)

Definition at line 175 of file F14SmallOverheads.cpp.

References k, and v.

Referenced by main().

178  {
179  m[k] = v;
180 }
auto v
KeyT k
FOLLY_NOINLINE void codeSize_bracket_F14Value ( F14ValueMap< int16_t, uint32_t > &  m,
int16_t  k,
uint32_t  v 
)

Definition at line 168 of file F14SmallOverheads.cpp.

References k, and v.

Referenced by main().

171  {
172  m[k] = v;
173 }
auto v
KeyT k
FOLLY_NOINLINE void codeSize_bracket_F14Vector ( F14VectorMap< int16_t, uint32_t > &  m,
int16_t  k,
uint32_t  v 
)

Definition at line 182 of file F14SmallOverheads.cpp.

References k, and v.

Referenced by main().

185  {
186  m[k] = v;
187 }
auto v
KeyT k
FOLLY_NOINLINE void codeSize_bracket_Std ( std::unordered_map< int16_t, uint32_t > &  m,
int16_t  k,
uint32_t  v 
)

Definition at line 161 of file F14SmallOverheads.cpp.

References k, and v.

Referenced by main().

164  {
165  m[k] = v;
166 }
auto v
KeyT k
FOLLY_NOINLINE void codeSize_erase_F14Node ( F14NodeMap< int16_t, uint32_t > &  m,
F14NodeMap< int16_t, uint32_t >::iterator  iter 
)

Definition at line 201 of file F14SmallOverheads.cpp.

Referenced by main().

203  {
204  m.erase(iter);
205 }
FOLLY_NOINLINE void codeSize_erase_F14Value ( F14ValueMap< int16_t, uint32_t > &  m,
F14ValueMap< int16_t, uint32_t >::iterator  iter 
)

Definition at line 195 of file F14SmallOverheads.cpp.

Referenced by main().

197  {
198  m.erase(iter);
199 }
FOLLY_NOINLINE void codeSize_erase_F14Vector ( F14VectorMap< int16_t, uint32_t > &  m,
F14VectorMap< int16_t, uint32_t >::iterator  iter 
)

Definition at line 207 of file F14SmallOverheads.cpp.

Referenced by main().

209  {
210  m.erase(iter);
211 }
FOLLY_NOINLINE void codeSize_erase_Std ( std::unordered_map< int16_t, uint32_t > &  m,
std::unordered_map< int16_t, uint32_t >::iterator  iter 
)

Definition at line 189 of file F14SmallOverheads.cpp.

Referenced by main().

191  {
192  m.erase(iter);
193 }
FOLLY_NOINLINE int codeSize_find_F14Node ( F14NodeMap< int16_t, float > &  m,
int16_t  k 
)

Definition at line 147 of file F14SmallOverheads.cpp.

References i.

Referenced by main().

149  {
150  auto i = m.find(k);
151  return i != m.end() ? 1 : 0;
152 }
KeyT k
FOLLY_NOINLINE int codeSize_find_F14Value ( F14ValueMap< int16_t, float > &  m,
int16_t  k 
)

Definition at line 140 of file F14SmallOverheads.cpp.

References i.

Referenced by main().

142  {
143  auto i = m.find(k);
144  return i != m.end() ? 1 : 0;
145 }
KeyT k
FOLLY_NOINLINE int codeSize_find_F14Vector ( F14VectorMap< int16_t, float > &  m,
int16_t  k 
)

Definition at line 154 of file F14SmallOverheads.cpp.

References i.

Referenced by main().

156  {
157  auto i = m.find(k);
158  return i != m.end() ? 1 : 0;
159 }
KeyT k
FOLLY_NOINLINE int codeSize_find_Std ( std::unordered_map< int16_t, float > &  m,
int16_t  k 
)

Definition at line 133 of file F14SmallOverheads.cpp.

References i.

Referenced by main().

135  {
136  auto i = m.find(k);
137  return i != m.end() ? 1 : 0;
138 }
KeyT k
int main ( int  ,
char **   
)

Definition at line 213 of file F14SmallOverheads.cpp.

References codeSize_bracket_F14Node(), codeSize_bracket_F14Value(), codeSize_bracket_F14Vector(), codeSize_bracket_Std(), codeSize_erase_F14Node(), codeSize_erase_F14Value(), codeSize_erase_F14Vector(), codeSize_erase_Std(), codeSize_find_F14Node(), codeSize_find_F14Value(), codeSize_find_F14Vector(), and codeSize_find_Std().

213  {
214  (void)codeSize_find_Std;
216  (void)codeSize_find_F14Node;
218 
219  (void)codeSize_bracket_Std;
223 
224  (void)codeSize_erase_Std;
228 
229  runSingleInserts<StdUnorderedMapTable>("std");
230  runSingleInserts<F14ValueMapTable>("f14value");
231  runSingleInserts<F14NodeMapTable>("f14node");
232  runSingleInserts<F14VectorMapTable>("f14vector");
233 
234  return 0;
235 }
FOLLY_NOINLINE int codeSize_find_Std(std::unordered_map< int16_t, float > &m, int16_t k)
FOLLY_NOINLINE void codeSize_bracket_F14Node(F14NodeMap< int16_t, uint32_t > &m, int16_t k, uint32_t v)
FOLLY_NOINLINE int codeSize_find_F14Node(F14NodeMap< int16_t, float > &m, int16_t k)
FOLLY_NOINLINE void codeSize_erase_F14Value(F14ValueMap< int16_t, uint32_t > &m, F14ValueMap< int16_t, uint32_t >::iterator iter)
FOLLY_NOINLINE void codeSize_erase_F14Node(F14NodeMap< int16_t, uint32_t > &m, F14NodeMap< int16_t, uint32_t >::iterator iter)
FOLLY_NOINLINE int codeSize_find_F14Value(F14ValueMap< int16_t, float > &m, int16_t k)
FOLLY_NOINLINE void codeSize_bracket_F14Vector(F14VectorMap< int16_t, uint32_t > &m, int16_t k, uint32_t v)
FOLLY_NOINLINE void codeSize_erase_Std(std::unordered_map< int16_t, uint32_t > &m, std::unordered_map< int16_t, uint32_t >::iterator iter)
FOLLY_NOINLINE void codeSize_erase_F14Vector(F14VectorMap< int16_t, uint32_t > &m, F14VectorMap< int16_t, uint32_t >::iterator iter)
FOLLY_NOINLINE void codeSize_bracket_Std(std::unordered_map< int16_t, uint32_t > &m, int16_t k, uint32_t v)
FOLLY_NOINLINE int codeSize_find_F14Vector(F14VectorMap< int16_t, float > &m, int16_t k)
FOLLY_NOINLINE void codeSize_bracket_F14Value(F14ValueMap< int16_t, uint32_t > &m, int16_t k, uint32_t v)
template<typename M >
void runSingleInsert ( std::string const &  name)

Definition at line 107 of file F14SmallOverheads.cpp.

References k, M, map(), and T.

107  {
108  cout << "----------------------\n";
109  cout << name << "\n";
110  cout << "SIZE = " << sizeof(M) << "\n";
111  cout << "CONSTRUCTING\n";
112  {
113  M map;
114  cout << "INSERTING 1 VALUE\n";
115  typename M::key_type k{};
116  map[k];
117  cout << "DESTROYING\n";
118  }
119  cout << "\n";
120 }
const char * name
Definition: http_parser.c:437
static Map map(mapCap)
**Optimized Holders **The template hazptr_array< M > provides most of the functionality *of M hazptr_holder s but with faster construction destruction *for M
Definition: Hazptr.h:104
KeyT k
template<template< typename, typename, template< typename > class > class T>
void runSingleInserts ( std::string const &  name)

Definition at line 123 of file F14SmallOverheads.cpp.

References name.

123  {
124  runSingleInsert<T<uint64_t, array<char, 8>, LoggingAlloc>>(
125  name + " uint64_t 8");
126  runSingleInsert<T<string, array<char, 8>, LoggingAlloc>>(name + " string 8");
127  runSingleInsert<T<uint64_t, array<char, 128>, LoggingAlloc>>(
128  name + " uint64_t 128");
129  runSingleInsert<T<string, array<char, 128>, LoggingAlloc>>(
130  name + " string 128");
131 }
const char * name
Definition: http_parser.c:437