c++ Programming Glossary: locality
C++ STL: should I store entire objects, or pointers to objects? http://stackoverflow.com/questions/141337/c-stl-should-i-store-entire-objects-or-pointers-to-objects copies will be more efficent since you'll get better locality of reference. Otoh if updates are common storing pointers will..
Get the first column of a matrix represented by a vector of vectors http://stackoverflow.com/questions/15778377/get-the-first-column-of-a-matrix-represented-by-a-vector-of-vectors It is fiddly to set up It is difficult to change Cache locality is bad. Here is a very simple class I have created that will..
What is “cache-friendly” code? http://stackoverflow.com/questions/16699247/what-is-cache-friendly-code of cache friendly code is all about the principle of locality the goal of which is to place related data close in memory to.. are of high importance to optimize caching Temporal locality when a given memory location was accessed it is likely that.. information will still be cached at that point. Spatial locality this refers to placing related data close to eachother. Caching..
1D or 2D array, what's faster? http://stackoverflow.com/questions/17259877/1d-or-2d-array-whats-faster 1D approach will be faster since it offers better memory locality and less allocation and deallocation overhead. 2. What's smaller.. size_t i 0 i 4 i delete p i delete p The downsides Memory locality For this matrix you allocate one block of four pointers and..
Relative performance of std::vector vs. std::list vs. std::slist? http://stackoverflow.com/questions/238008/relative-performance-of-stdvector-vs-stdlist-vs-stdslist is expected to perform better than list if only for data locality issues this means that if two elements that are adjacent in..
How can I quickly enumerate directories on Win32? http://stackoverflow.com/questions/2511672/how-can-i-quickly-enumerate-directories-on-win32 recursing into the sub folders you found. This improves locality usually a lot. On Windows 7 W2K8R2 you can use FindFirstFileEx..
F# performance in scientific computing http://stackoverflow.com/questions/2752229/f-performance-in-scientific-computing it have Does it allow fine grained control over memory locality does it have capacity for distributed memory processors for.. computing I guess due to their inherently good memory locality properties. For scientific computation packages using F# you..
Why are unnamed namespaces used and what are their benefits? http://stackoverflow.com/questions/357404/why-are-unnamed-namespaces-used-and-what-are-their-benefits has external linkage sample a1 s1 NOT OK translation unit locality is done by giving a2 internal linkage. sample a2 s2 Template..
Why is sizeof(string) == 32? http://stackoverflow.com/questions/3770781/why-is-sizeofstring-32 allocations for lots of small string objects and improves locality of reference. Furthermore there will be a std size_t member..
Why would I prefer using vector to deque http://stackoverflow.com/questions/5345152/why-would-i-prefer-using-vector-to-deque needs contiguous arrays or if you care a lot about spatial locality then you might prefer vector . In addition since there is some..
About deque<T>'s extra indirection http://stackoverflow.com/questions/8305492/about-dequets-extra-indirection extra layer of indirection built in destroying my memory locality. i.e. it seems to hold an array of T not an array of T . Is..
Layout in memory of a struct. struct of arrays and array of structs in C/C++ http://stackoverflow.com/questions/8377667/layout-in-memory-of-a-struct-struct-of-arrays-and-array-of-structs-in-c-c as each object is kept together. AoS may have better cache locality if all the members of the struct are accessed together. SoA..
std::lower_bound slower for std::vector than std::map::find http://stackoverflow.com/questions/8784732/stdlower-bound-slower-for-stdvector-than-stdmapfind should have outperformed std map due to better cache locality smaller memory size and since the map can be imperfectly balanced..
Efficiency of vector index access vs iterator access http://stackoverflow.com/questions/9506018/efficiency-of-vector-index-access-vs-iterator-access support random access iterators are likely to have better locality than those which don't which might work in favor of random access..
Comprehensive vector vs linked list benchmark for randomized insertions/deletions http://stackoverflow.com/questions/9764452/comprehensive-vector-vs-linked-list-benchmark-for-randomized-insertions-deletion Native 2012 where he talks about how processor caching and locality of reference really help with vectors but not at all or enough..
|