Optimizing floating point operations in Scheme

  • Authors:
  • W. F. Wong

  • Affiliations:
  • Department of Computer Science, National University of Singapore, Lower Kent Ridge Road, Singapore, 119260, Republic of Singapore

  • Venue:
  • Computer Languages
  • Year:
  • 1999

Quantified Score

Hi-index 0.00

Visualization

Abstract

It is well known that dynamic typing in languages like Lisp is costly in terms of performance. Besides the cost of tag checking, the other major source of inefficiency comes from the need to place and retrieve data from dynamically allocated objects, i.e. boxing and unboxing. This makes it unacceptable in general to write numerical code in Lisp. Such programs involve ''tight'' loops in which boxing, unboxing and tag checking will dominate the computation time. With advances in the compilation of Lisp programs, it has been suggested that type checking and inference can be used to alleviate the problem. In this paper we shall examine a sub-problem, namely using type inference to aid compilation of numerical intensive Lisp code. A type inference algorithm for floating point operations will be described. This has been implemented in a Scheme compiler. Implementation issues and performance results on fairly large numerical code will also be reported. The results suggest that significant performance gains can be obtained. It is our hope that as an augmentation to other general type inferencing scheme, it will contribute towards the realization of highly optimizing Scheme compilers.