Skip to main content
U.S. flag

An official website of the United States government

Efficient processing of two-dimensional arrays with C or C++

July 20, 2017

Because fast and efficient serial processing of raster-graphic images and other two-dimensional arrays is a requirement in land-change modeling and other applications, the effects of 10 factors on the runtimes for processing two-dimensional arrays with C and C++ are evaluated in a comparative factorial study. This study’s factors include the choice among three C or C++ source-code techniques for array processing; the choice of Microsoft Windows 7 or a Linux operating system; the choice of 4-byte or 8-byte array elements and indexes; and the choice of 32-bit or 64-bit memory addressing. This study demonstrates how programmer choices can reduce runtimes by 75 percent or more, even after compiler optimizations. Ten points of practical advice for faster processing of two-dimensional arrays are offered to C and C++ programmers. Further study and the development of a C and C++ software test suite are recommended.

Key words: array processing, C, C++, compiler, computational speed, land-change modeling, raster-graphic image, two-dimensional array, software efficiency

Publication Year 2017
Title Efficient processing of two-dimensional arrays with C or C++
DOI 10.3133/tm7E1
Authors David I. Donato
Publication Type Report
Publication Subtype USGS Numbered Series
Series Title Techniques and Methods
Series Number 7-E1
Index ID tm7E1
Record Source USGS Publications Warehouse
USGS Organization Eastern Geographic Science Center