Optimization for CPU cache
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// md5_crc.c
|
||||
// Copyright : 2022-10-01 Yutaka Sawada
|
||||
// Copyright : 2023-08-28 Yutaka Sawada
|
||||
// License : GPL
|
||||
|
||||
#ifndef _UNICODE
|
||||
@@ -672,7 +672,7 @@ time1_start = GetTickCount();
|
||||
|
||||
// バッファー・サイズが大きいのでヒープ領域を使う
|
||||
for (io_size = IO_SIZE; io_size < 1048576; io_size += IO_SIZE){ // 1 MB までにする
|
||||
if ((io_size + IO_SIZE > (cpu_cache << 17)) || ((__int64)(io_size + IO_SIZE) * 4 > file_left))
|
||||
if ((io_size + IO_SIZE > (cpu_cache & 0xFFFE0000)) || ((__int64)(io_size + IO_SIZE) * 4 > file_left))
|
||||
break;
|
||||
}
|
||||
buf1 = _aligned_malloc(io_size * 2, 64);
|
||||
@@ -867,7 +867,7 @@ DWORD WINAPI file_hash_crc2(LPVOID lpParameter)
|
||||
// バッファー・サイズが大きいのでヒープ領域を使う
|
||||
prog_tick = 1;
|
||||
for (io_size = IO_SIZE; io_size < 1048576; io_size += IO_SIZE){ // IO_SIZE の倍数で 1 MB までにする
|
||||
if ((io_size + IO_SIZE > (cpu_cache << 17)) || ((__int64)(io_size + IO_SIZE) * 4 > file_left))
|
||||
if ((io_size + IO_SIZE > (cpu_cache & 0xFFFE0000)) || ((__int64)(io_size + IO_SIZE) * 4 > file_left))
|
||||
break;
|
||||
prog_tick++;
|
||||
}
|
||||
@@ -1304,7 +1304,7 @@ DWORD WINAPI file_hash_background(LPVOID lpParameter)
|
||||
|
||||
// バッファー・サイズが大きいのでヒープ領域を使う
|
||||
for (io_size = IO_SIZE; io_size < 1048576; io_size += IO_SIZE){ // IO_SIZE の倍数で 1 MB までにする
|
||||
if ((io_size + IO_SIZE > (cpu_cache << 17)) || ((__int64)(io_size + IO_SIZE) * 4 > file_size))
|
||||
if ((io_size + IO_SIZE > (cpu_cache & 0xFFFE0000)) || ((__int64)(io_size + IO_SIZE) * 4 > file_size))
|
||||
break;
|
||||
}
|
||||
//printf("\n io_size = %d\n", io_size);
|
||||
|
||||
Reference in New Issue
Block a user