mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-21 23:46:27 -05:00
Refactors vector operations.
This commit is contained in:
parent
29b411e3fe
commit
cae803bdfb
10 changed files with 75 additions and 76 deletions
|
|
@ -28,26 +28,27 @@
|
|||
*
|
||||
* When allocating a sequence of blocks with a size of power of 2,
|
||||
* there is the risk that the start of each block is mapped into the same
|
||||
* cache line, resulting in cache collisions if you access all the blocks
|
||||
* in parallel, from the start to the end.
|
||||
* cache line or prefetching prediction, resulting in collisions if you
|
||||
* access all the blocks in parallel, from the start to the end.
|
||||
*
|
||||
* The selected value was choosen empirically with some speed tests
|
||||
* with 8/12/16/20/24 data buffers of 256 KB.
|
||||
*
|
||||
* With displacement:
|
||||
* (8 buffers of 256 KB, icore5, 32 bits):
|
||||
* These are the results with no displacement:
|
||||
*
|
||||
* sse2
|
||||
* par1 21936 [MB/s]
|
||||
* par2 11902 [MB/s]
|
||||
* parz 5838 [MB/s]
|
||||
* sse2
|
||||
* par1 15368 [MB/s]
|
||||
* par2 6814 [MB/s]
|
||||
* parz 3033 [MB/s]
|
||||
*
|
||||
* Without displacement:
|
||||
* These are the results with displacement resulting in improvments
|
||||
* in the order of 20% or more:
|
||||
*
|
||||
* sse2
|
||||
* par1 21936 [MB/s]
|
||||
* par2 11902 [MB/s]
|
||||
* parz 5838 [MB/s]
|
||||
*
|
||||
* sse2
|
||||
* par1 15368 [MB/s]
|
||||
* par2 6814 [MB/s]
|
||||
* parz 3033 [MB/s]
|
||||
*/
|
||||
#define RAID_MALLOC_DISPLACEMENT (7*256)
|
||||
|
||||
|
|
@ -58,22 +59,22 @@ void *raid_malloc_align(size_t size, void **freeptr);
|
|||
|
||||
/**
|
||||
* Aligned vector allocation.
|
||||
* Returns a vector of "count" pointers, each one pointing to a block of the
|
||||
* specified "size".
|
||||
* The first "reverse" pointers are put in reverse memory offset order.
|
||||
* Returns a vector of ::n pointers, each one pointing to a block of
|
||||
* the specified ::size.
|
||||
* The first ::nd elements are reversed in order.
|
||||
*/
|
||||
void **raid_malloc_vector(size_t reverse, size_t count, size_t size, void **freeptr);
|
||||
void **raid_malloc_vector(int nd, int n, size_t size, void **freeptr);
|
||||
|
||||
/**
|
||||
* Fills the memory vector with random data.
|
||||
*/
|
||||
void raid_mrand_vector(int n, size_t size, void **vv);
|
||||
|
||||
/**
|
||||
* Tests the memory vector for RAM problems.
|
||||
* If a problem is found, it crashes.
|
||||
*/
|
||||
int raid_mtest_vector(void **vv, size_t count, size_t size);
|
||||
|
||||
/**
|
||||
* Fills the memory vector with random data.
|
||||
*/
|
||||
void raid_mrand_vector(void **vv, size_t count, size_t size);
|
||||
int raid_mtest_vector(int n, size_t size, void **vv);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue