Benchmarking RAM performance - UWP and C#

2019-07-24 15:08发布

I'm developing a benchmarking application using Universal Windows Platform that evaluates CPU and RAM performance of a Windows 10 system.

Although I found different algorithms to benchmark a CPU, I still didn't found any solid algorithm or solution to evaluate the write and read speeds of memory.

How can I achieve this in C#?

Thanks in advance :)

1条回答
Deceive 欺骗
2楼-- · 2019-07-24 15:26

I don't see why this would not be possible from managed code. Array access code turns into normal x86 memory instructions. It's a thin abstraction. In particular I don't see why you would need a customized OS.

You should be able to test sequential memory speed by performing memcpy on big arrays. They must be bigger than the last level cache size.

You can test random access by randomly indexing into a big array. The index calculation must be cheap, unpredictable and there must be a dependency chain that serializes the memory instructions so that the CPU cannot parallelize them.

Honestly I don't think its possible. RAM benchmarks usually run off of dedicated OS's

RAM testing is different from RAM benchmarking.

C# doesn't give you that kind of control over RAM

Of course, just new up a big array and access it. Also, understand the overheads that are present. The only overhead is a range check.

The GC has no impact during the benchmark. It might be triggered by an allocation.

查看更多
登录 后发表回答