Run Code  | API  | Code Wall  | Misc  | Feedback  | Login  | Theme  | Privacy  | Patreon 

stlsizeof.cc

Language: Layout:
+ ] Compiler args + ] Show input
Compilation time: 1.98 sec, absolute running time: 0.18 sec, cpu time: 0.06 sec, memory peak: 3 Mb, absolute service time: 2,17 sec 
edit mode |  history  | discussion
Displaying memory usage in bytes.
Filling data structures with 1024 elements and reporting the per element memory usage.
memory usage per element of a vector<uint32_t> : 4
memory usage per element of a list<uint32_t> : 24
memory usage per element of a deque<uint32_t> : 4.64062
memory usage per element of an unordered_set<uint32_t> : 29.6016
memory usage per element of a set<uint32_t> : 40
Comments : 
This is an optimistic estimate: the overhead of the data structure and the allocations is ignored.
Because the per-value overhead might be fixed, the results might be less dramatic with larger elements, such as long strings.