Suppose there is a cpu with a cache line of 64 Bytes. Now you need to access all the data of a 2D image stored in the main sequence of the line by pixel. The image size is 1024*1024, of which there are 4 channels per pixel. The channel has 4 Bytes, 4 channels of data are continuously stored, given four scanning modes

  • A. Line-by-row access from left to right,
  • B. Line-by-line access from right to left,
  • C. Column-by-column access from top to bottom,
  • D. Columns from bottom to top

How to analyze the speed of these four access methods without considering the hardware reading mechanism

New contributor
Wang is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • 2
    By "without considering the hardware reading mechanism" do you mean file reading? Are you just asking what will be quickest to process once the image is resident in memory? If so, you just need to understand how the image is arranged in memory, i.e. row-by-row, and how a CPU cache works. Short answer is "A". – Simon F Sep 14 at 8:34

Your Answer

Wang is a new contributor. Be nice, and check out our Code of Conduct.

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.