Memory benchmarks – writes

All the benchmarks executed so far performed only read operations. So, what about write performance, will they be as fast as reads? In the case of writes we will only be interested in sequential and random reads. The code is almost identical to the one used for the read benchmarks, but instead of reading the value from the array, I write the value of the current index:

for (int i = 0; i < steps; i++) array[(11587L*i) & mask] = i;


for (int i = 0; i < steps; i++) array[i] = i;

To facilitate the comparison between reads and writes I included the results of the read benchmarks. For sequential access, we have:


Where we see that single and dual threaded sequential write bandwidth is identical to read bandwidth, but for a larger number of threads these two diverge with the write bandwidth saturating at about 20 GB/s, while the read bandwidth reaches 40 GB/s with six threads.

For random access there is much less difference between the two cases:


Note that for both benchmarks a single 1 GB array of longs is accessed by all threads. In terms of access time or frequency we are speaking of 18 ns and 56 MHz.

Remember that these results are specific to C# on .Net, better performance is expected from e.g. C++ code or .Net native. It would be worth reproducing the sequential writes benchmark in C++ or in Java to confirm that we are not hitting a .Net bottleneck.

The code is available on Github.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Awelon Blue

Thoughts on Programming Experience Design

Joe Duffy's Blog

Adventures in the High-tech Underbelly

Design Matters

Furniture design blog from Design Matters author George Walker


A Blog for Woodworkers by Gary Rogowski


Woodworking, life and all things between

%d bloggers like this: