Reducing Computational Complexity with Array Predicates

[This paper originally appeared in the APL98 Conference Proceedings.]

This article describes how Array Predicates were used to reduce the computational complexity of four APL primitive functions when one of their arguments is a permutation vector. The search primitives, indexof and set membership, and the sorting primitives, upgrade and downgrade, execute in linear time on such arguments. Our contribution, a method for static determination of array properties, lets us generate code that is optimized for special cases of primitives. Our approach eliminates run-time checks which would otherwise slow down the execution of all cases of the effected primitives. We use the same analysis technique to reduce the type complexity of certain array primitives.

The Array Predicates article is available in PDF (55k) format and in PostScript (127k) format.