Fill CPU cache with NOPs

Hello!
For benchmarking purposes, I would like to fulfull the CPU's cache with nops, before executing the actual code.The solution I've implemented uses macroses: https://ideone.com/2f3sIq

It should work, but the problem, that it takes ~1200ms for a compiler to compile it. Isn't there any better way?
Last edited on
How would you know it's working?
I see the dissambly here and in Visual Studio. Looks to be pretty fair:
https://godbolt.org/z/hEO6Ug

Also, I measure the run-time and see, that it's increasing proportionally to the amount of nops I'm adding. Even in the release mode.
So what is a cache full of NOPs as opposed to say your usual run of the mill arithmetic and logical operations supposed to prove to you?
It should work, but the problem, that it takes ~1200ms for a compiler to compile it. Isn't there any better way?

Make sure it's in a file by itself so you only have to compile it once.
It takes less than a second to compile for me, but may I ask what is wrong with taking 1.2s to compile something?
Topic archived. No new replies allowed.