Efficiency in C and C++ -
so teacher tells me should compute intermediate results needed on fly rather storing them, because speed of processors nowadays more faster speed of memory.
so when compute intermediate result, need use memory right ? can please explain me ?
so when compute intermediate result, need use memory right ? can please explain me?
there several levels of memory in computer. layers this
- registers – cpu calculations on , access instant
- caches - memory that's tightly coupled cpu core; memory accesses main system memory go through cache , program looks if data goes , comes system memory. if data present in cache , access aligned access instant , hence fast.
- main system memory - connected cpu through memory controller , shared cpu cores in system. accessing main memory introduces latencies through addressing , limited bandwidth between memory , cpus
when work in-situ calculated intermediary results never leave registers or may go far cache , not limited available system memory bandwidth or blocked memory bus arbitration or address generation interlock.
Comments
Post a Comment