AI for Games by Ian Millington;
Author:Ian Millington; [Millington;, Ian]
Language: eng
Format: epub
ISBN: 9780367643447
Publisher: CRC Press
Published: 2021-08-28T00:00:00+00:00
Cache
Memory size alone isnât the only limitation on memory use. The time it takes to access memory from the RAM and prepare it for use by the processor is significantly longer than the time it takes for the processor to perform its operations. If processors had to rely on the main RAM, theyâd be constantly stalled waiting for data.
All modern processors use at least one level of cache: a copy of the RAM held in the processor that can be very quickly manipulated. Cache is typically fetched in pages; a whole section of main memory is streamed to the processor. It can then be manipulated at will. When the processor has done its work, the cached memory is sent back to the main memory. The processor typically cannot work on the main memory: All the memory it needs must be on cache. An operating system may add additional complexity to this, as a memory request may have to pass through an operating system routine that translates the request into a request for real or virtual memory. This can introduce further constraints, as two bits of physical memory with a similar mapped address might not be available at the same time (called an aliasing failure).
Multiple levels of cache work the same way as a single cache. A large amount of memory is fetched to the lowest level cache, a subset of that is fetched to each higher-level cache, and the processor only ever works on the highest level.
If an algorithm uses data spread around memory, then it is unlikely that the right memory will be in the cache from moment to moment. These cache misses are costly in time. The processor has to fetch a whole new chunk of memory into the cache for one or two instructions, then it has to stream it all back out and request another block. A good profiling system will show when cache misses are happening. In my experience, even in languages that donât give you control over memory layout, dramatic speedups can be achieved by making sure that all the data needed for one algorithm are kept in the same place, in the same few objects.
In a game with 1,000 characters, it may be better to keep all their positions together in an array, so algorithms that make calculations based on location donât need to constantly jump around memory. As with all optimizations, profiling is everything, but a general level of efficiency can be gained by programming with data coherence in mind.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
What's Done in Darkness by Kayla Perrin(26963)
The Ultimate Python Exercise Book: 700 Practical Exercises for Beginners with Quiz Questions by Copy(20861)
De Souza H. Master the Age of Artificial Intelligences. The Basic Guide...2024 by Unknown(20622)
D:\Jan\FTP\HOL\Work\Alien Breed - Tower Assault CD32 Alien Breed II - The Horror Continues Manual 1.jpg by PDFCreator(20540)
The Fifty Shades Trilogy & Grey by E L James(19469)
Shot Through the Heart: DI Grace Fisher 2 by Isabelle Grey(19386)
Shot Through the Heart by Mercy Celeste(19244)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 10 by Isuna Hasekura and Jyuu Ayakura(17391)
Python GUI Applications using PyQt5 : The hands-on guide to build apps with Python by Verdugo Leire(17363)
Peren F. Statistics for Business and Economics...Essential Formulas 3ed 2025 by Unknown(17193)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 03 by Isuna Hasekura and Jyuu Ayakura & Jyuu Ayakura(17103)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 01 by Isuna Hasekura and Jyuu Ayakura & Jyuu Ayakura(16716)
The Subtle Art of Not Giving a F*ck by Mark Manson(14842)
The 3rd Cycle of the Betrayed Series Collection: Extremely Controversial Historical Thrillers (Betrayed Series Boxed set) by McCray Carolyn(14443)
Stepbrother Stories 2 - 21 Taboo Story Collection (Brother Sister Stepbrother Stepsister Taboo Pseudo Incest Family Virgin Creampie Pregnant Forced Pregnancy Breeding) by Roxi Harding(14232)
Cozy crochet hats: 7 Stylish and Beginner-Friendly Patterns from Baby Beanies to Trendy Bucket Hats by Vanilla Lazy(13511)
Scorched Earth by Nick Kyme(13106)
Reichel W. Numerical methods for Electrical Engineering, Meteorology,...2022 by Unknown(12980)
Drei Generationen auf dem Jakobsweg by Stein Pia(11268)