Which type of caching will make the following code faster fl
Which type of caching will make the following code faster:
float a = 0;
for (int i=0;i<1000000;i++)
a += i*7+5;
Spatial Locality
Temporal Locality
Both, equally
Neither
| a. | Spatial Locality | |
| b. | Temporal Locality | |
| c. | Both, equally | |
| d. | Neither |
Solution
Temporal locality caching would help getting the code faster as the float variable a previous value is going to be used in every iteration and temporary locality caching is basically a concept where a resource that is reference for one time would be referenced again in near future
