diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-06-11 19:05:20 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-06-11 19:05:20 -0700 |
commit | 3c8451a078ef0a61143c67590ebdf3e407f29182 (patch) | |
tree | d283c734cdd9e469bc5a8873796f43daf2db3325 /tests | |
parent | 30537ea5fca2ceb0b09dd3e8af2a5443b35a697a (diff) |
optimize memset and memcpy in ta2
Diffstat (limited to 'tests')
-rw-r--r-- | tests/runner.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py index 2a7321b7..a7888238 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -2729,6 +2729,28 @@ else: ''' self.do_benchmark(src, [], 'lastprime: 1297001.') + def test_memops(self): + src = ''' + #include<stdio.h> + #include<string.h> + #include<stdlib.h> + int main() { + int N = 10*1024*1024; + int final = 0; + char *buf = (char*)malloc(N); + for (int t = 0; t < 20; t++) { + for (int i = 0; i < N; i++) + buf[i] = (i*i)%256; + memcpy(buf, buf+N/2, N/2); + for (int i = 0; i < N; i++) + final += buf[i] & 1; + } + printf("final: %d.\\n", final); + return 1; + } + ''' + self.do_benchmark(src, [], 'final: 104857600.') + def test_fannkuch(self): src = open(path_from_root('tests', 'fannkuch.cpp'), 'r').read() self.do_benchmark(src, ['10'], 'Pfannkuchen(10) = 38.') |