X

NV5 Geospatial Blog

Each month, NV5 Geospatial posts new blog content across a variety of categories. Browse our latest posts below to learn about important geospatial information or use the search bar to find a specific topic or author. Stay informed of the latest blog posts, events, and technologies by joining our email list!



Not All Supernovae Are Created Equal: Rethinking the Universe’s Measuring Tools

Not All Supernovae Are Created Equal: Rethinking the Universe’s Measuring Tools

6/3/2025

Rethinking the Reliability of Type 1a Supernovae   How do astronomers measure the universe? It all starts with distance. From gauging the size of a galaxy to calculating how fast the universe is expanding, measuring cosmic distances is essential to understanding everything in the sky. For nearby stars, astronomers use... Read More >

Using LLMs To Research Remote Sensing Software: Helpful, but Incomplete

Using LLMs To Research Remote Sensing Software: Helpful, but Incomplete

5/26/2025

Whether you’re new to remote sensing or a seasoned expert, there is no doubt that large language models (LLMs) like OpenAI’s ChatGPT or Google’s Gemini can be incredibly useful in many aspects of research. From exploring the electromagnetic spectrum to creating object detection models using the latest deep learning... Read More >

From Image to Insight: How GEOINT Automation Is Changing the Speed of Decision-Making

From Image to Insight: How GEOINT Automation Is Changing the Speed of Decision-Making

4/28/2025

When every second counts, the ability to process geospatial data rapidly and accurately isn’t just helpful, it’s critical. Geospatial Intelligence (GEOINT) has always played a pivotal role in defense, security, and disaster response. But in high-tempo operations, traditional workflows are no longer fast enough. Analysts are... Read More >

Thermal Infrared Echoes: Illuminating the Last Gasp of a Dying Star

Thermal Infrared Echoes: Illuminating the Last Gasp of a Dying Star

4/24/2025

This blog was written by Eli Dwek, Emeritus, NASA Goddard Space Flight Center, Greenbelt, MD and Research Fellow, Center for Astrophysics, Harvard & Smithsonian, Cambridge, MA. It is the fifth blog in a series showcasing our IDL® Fellows program which supports passionate retired IDL users who may need support to continue their work... Read More >

A New Era of Hyperspectral Imaging with ENVI® and Wyvern’s Open Data Program

A New Era of Hyperspectral Imaging with ENVI® and Wyvern’s Open Data Program

2/25/2025

This blog was written in collaboration with Adam O’Connor from Wyvern.   As hyperspectral imaging (HSI) continues to grow in importance, access to high-quality satellite data is key to unlocking new insights in environmental monitoring, agriculture, forestry, mining, security, energy infrastructure management, and more.... Read More >

1345678910Last
«July 2025»
SunMonTueWedThuFriSat
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789
15621 Rate this article:
4.3

The speed of IDL compared with other languages

Anonym

Because IDL is array based, it can give very good execution speed compared with other programming languages. The main reason is that array based computations tend to optimize memory access patterns since array elements are stored adjacent in memory and accessed in sequence. Because actual computation speed has gotten much faster over time, it is often not the bottleneck for achieving good speed on a computational algorithm. Instead, memory access, memory caching, and cache misses are what dominates the speed by slowing down the performance.

I wanted to do a simple, unscientific speed comparison using an algorithm that I have already implemented earlier. I chose the LSD radix sort algorithm since the Wikipedia article includes example code for several programming languages: C, C++, C++14, Python, Java. See this link.  Also see this IDL blog for reference.

I modified the code for all the languages to use a 10,000,000 element 32-bit integer array containing random integers between 0 - 9,999,999. The main modifications were to use a radix (base) of 256, and use a dynamically allocated array that could handle 10,000,000 elements. For the examples that used radix 10 (Java), I also needed to expand the buckets to 256 to hold the histogram for each iteration.

I ran all the tests on the same 6-core Intel(R) Xeon(R) system.Here are the results:

Python:  16.3 seconds(after optimizing a bit, original was 29.3 seconds)

C++: 14.0 seconds

Java: 9.2 seconds

C++14: 2.2 seconds

IDL: 0.86 seconds

C:  0.72 seconds

In my test IDL ends up in a close second place behind the C implementation. Obviously, these code examples are not fully optimized for speed, but might be representative of how people write code when there is not enough time to spend on optimizing the code. I would also mention that the readability of the IDL code is a significant advantage.  The IDL code is done in 20 lines, whereas the C code uses 76 lines. This makes it easy to add changes and improvements to the IDL code.

This is an example where IDL performs very well. There are obviously other cases where IDL code can run much slower than optimal.  I have found that in most cases when my IDL code runs slow, it is caused by using too many loops and scalar operations instead of more array based operations.

Here is the code listing for the IDL version of the10,000,000 element integer sort, (it also runs 3.8 times faster than IDL's built in sort, for this particular case):

pro idlRadix

 compile_opt idl2,logical_predicate

 

 n = 10000000

 data = randomu(seed, n, /long) mod n

 sorted = data

 

 tic

 radix = 256LL

 factor = 1ull

 for i=0,3 do begin

   rem = sorted/factor

   digit = rem mod radix

   factor = factor*radix

   h = histogram(digit, min=0, max=radix-1, binsize=1, $

     reverse_indices=ri)

   sorted = sorted[ri[radix+1:*]]

 endfor

 toc

 

 tic

 tmp = data[sort(data)]

 toc

 

 if array_equal(tmp, sorted) then print, 'Sorted correctly'

end

Please login or register to post comments.