prevent silly overflow in memops benchmark, to make it more fair
This commit is contained in:
Родитель
70edb25e68
Коммит
8fc2acdc4e
|
@ -3050,20 +3050,22 @@ else:
|
||||||
#include<string.h>
|
#include<string.h>
|
||||||
#include<stdlib.h>
|
#include<stdlib.h>
|
||||||
int main() {
|
int main() {
|
||||||
int N = 4*1024*1024;
|
int N = 1024*1024;
|
||||||
|
int M = 600;
|
||||||
int final = 0;
|
int final = 0;
|
||||||
char *buf = (char*)malloc(N);
|
char *buf = (char*)malloc(N);
|
||||||
for (int t = 0; t < 20; t++) {
|
for (int t = 0; t < M; t++) {
|
||||||
for (int i = 0; i < N; i++)
|
for (int i = 0; i < N; i++)
|
||||||
buf[i] = (i*i + final)%256;
|
buf[i] = (i + final)%256;
|
||||||
for (int i = 0; i < N; i++)
|
for (int i = 0; i < N; i++)
|
||||||
final += buf[i] & 1;
|
final += buf[i] & 1;
|
||||||
|
final = final % 1000;
|
||||||
}
|
}
|
||||||
printf("final: %d.\\n", final);
|
printf("final: %d.\\n", final);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
'''
|
'''
|
||||||
self.do_benchmark(src, [], 'final: 41943040.')
|
self.do_benchmark(src, [], 'final: 800.')
|
||||||
|
|
||||||
def test_fannkuch(self):
|
def test_fannkuch(self):
|
||||||
src = open(path_from_root('tests', 'fannkuch.cpp'), 'r').read()
|
src = open(path_from_root('tests', 'fannkuch.cpp'), 'r').read()
|
||||||
|
|
Загрузка…
Ссылка в новой задаче