Warning: Undefined property: syntax_plugin_markdowku_anchorsreference::$nested_brackets_re in C:\WebServer\www\ff_internal\lib\plugins\markdowku\syntax\anchorsreference.php on line 35
Warning: Undefined array key 1 in C:\WebServer\www\ff_internal\lib\plugins\markdowku\syntax\anchorsreference.php on line 39
Warning: Undefined array key 2 in C:\WebServer\www\ff_internal\lib\plugins\markdowku\syntax\anchorsreference.php on line 41
Warning: Undefined array key 1 in C:\WebServer\www\ff_internal\lib\plugins\markdowku\syntax\anchorsreference.php on line 42
Warning: Cannot modify header information - headers already sent by (output started at C:\WebServer\www\ff_internal\lib\plugins\markdowku\syntax\anchorsreference.php:35) in C:\WebServer\www\ff_internal\inc\parser\code.php on line 39
Warning: Cannot modify header information - headers already sent by (output started at C:\WebServer\www\ff_internal\lib\plugins\markdowku\syntax\anchorsreference.php:35) in C:\WebServer\www\ff_internal\inc\parser\code.php on line 40
Warning: Cannot modify header information - headers already sent by (output started at C:\WebServer\www\ff_internal\lib\plugins\markdowku\syntax\anchorsreference.php:35) in C:\WebServer\www\ff_internal\inc\parser\code.php on line 41
#include
#include
#include
#include
int main(int argc, char** argv) {
int size = std::stoi(argv[1]);
std::vector> data(size, std::vector(size));
struct timeval b;
gettimeofday(&b, nullptr);
# 按列遍历,避免 CPU cache 的影响
for (int col = 0; col < size; ++col) {
for (int row = 0; row < size; ++row) {
data[row][col] = rand();
}
}
struct timeval e;
gettimeofday(&e, nullptr);
std::cout << "Use time "
<< e.tv_sec * 1000000 + e.tv_usec - b.tv_sec * 1000000 - b.tv_usec
<< "us" << std::endl;
}
# numactl --cpubind=0 --membind=0 ./numa_test 20000
Use time 16465637us
# numactl --cpubind=0 --membind=1 ./numa_test 20000
Use time 21402436us