Welcome to Computer Technology Tips Blog !

February 09 2010

Using Machine Language Subroutines For High Speed Vector Mathematics

Tagged Under : , ,

A number of years ago I worked on a project that required extensive manipulation of digital waveforms; the waveforms were stored in double precision floating point vectors (or arrays if you prefer). We quickly discovered that even when we compiled the programs we were not getting the speed required because of the loops needed to step through the entire vector. Not having any direct vector oriented operators such as those available in APL we decided to create our own subroutines that we could pass a vector to and have the operation done quickly in machine language.

Of course we gained a lot of speed but did get the downside of being tied to a particular hardware processor without reprogramming the assemble language code. But… notice how tight the RESET: loop is (three instructions) used in the sample program below… sweet!

Partners