Data Caching and Code Optimizations

The Partridge Family were neither partridges nor a family. Discuss.
albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Data Caching and Code Optimizations

Post by albinopapa » January 13th, 2017, 7:11 am

SOA Count = 200000
AOS Count = 20000

Can you see where the 10x speed up comes from?

I would probably make a statement at the top

constexpr auto numElements = 200000ui64;

Then just use the numElements to init all your array sizes and counts. Doing that I get

SOA Time taken: 0.00158667
AOS Time taken: 0.00180841

Those times are in seconds instead of the large nanoseconds

Here are the nano-seconds
SOA Time taken: 1606395
AOS Time taken: 2109330

Here are my specs, btw:
AMD (APU) A10 7870K CPU @ 3.9ghz
12GB DDR3-1333 (10.8GB usable)
Windows 10 64x
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

User avatar
cyboryxmen
Posts: 190
Joined: November 14th, 2014, 2:03 am

Re: Data Caching and Code Optimizations

Post by cyboryxmen » January 13th, 2017, 7:53 am

Oh hey you read my unedited post. You should read the latest one where I posted the more accurate results. The gist of it is that I started with a single .exe and it gave me weird results. That was where I separated it into two solutions generating 2 .exes but I set the other to debug instead of release(plus the different sizes). The disadvantage of programming two .exes at once.

The results vary a little. Sometimes Struct of Arrays is slightly better. Sometimes Array of Struct is slightly better. They do average out and in the end, their timings are pretty much the same.
Zekilk

Post Reply