16.8 C
Monday, August 21, 2017

How to speed your code using CPU caches

The CPUrsquo;s cache reduces memory latency when data is accessed from the main system memory.

Developers can and should take advantage of CPU cache to improve application performance.How CPU caches work Modern CPUs typically have three levels of cache, labeled L1, L2, and L3, which reflects the order in which the CPU checks them.

CPUs often have a data cache, an instruction cache (for code), and a unified cache (for anything).

Accessing these caches are much faster than accessing the RAM: Typically, the L1 cache is about 100 times faster than the RAM for data access, and the L2 cache is 25 times faster than RAM for data access.[ 9 lies programmers tell themselves. | 9 bad programming habits we secretly love. ]When your software runs and needs to pull in data or instructions, the CPU caches are checked first, then the slower system RAM, and finally the much slower disk drives.

Thatrsquo;s why you want to optimize your code to seek what is likely to be needed from the CPU cache first.To read this article in full or to leave a comment, please click here

HTC Vive gets its first permanent price cut, now down 25...

That's a $200 savings, but still not as cheap as $399 Oculus Touch bundle.

Mirai copycats fired the IoT-cannon at game hosts, researchers find

After first wave attacks ended, thing-herders took aim at PlayStation, XBOX and Valve The Mirai botnet that took down large chunks of the Internet in 2016 was notable for hosing targets like Krebs on Security and domain host Dyn, but research presented at a security conference last week suggests a bunch of high-profile game networks were also targeted.…