Optimisation of Generic Programs Through Inlining
نویسنده
چکیده
It is known that datatype-generic programs often run slower than typespecific variants, and this factor can prevent adoption of generic programming altogether. There can be multiple reasons for the performance penalty, but often it is caused by conversions to and from representation types that do not get eliminated during compilation. However, it is also known that generic functions can be specialised to specific datatypes, removing any overhead from the use of generic programming. In this paper, we investigate compilation techniques to specialise generic functions and remove the performance overhead of generic programs in Haskell. We pick a representative generic programming library and look at the generated code for a number of example generic functions. After understanding the necessary compiler optimisations for producing efficient generic code, we benchmark the runtime of our generic functions against handwritten variants, and conclude that the overhead can indeed be removed automatically by the compiler.
منابع مشابه
Specialization of Generic Array Accesses After Inlining
We have implemented an optimization that specializes type-generic array accesses after inlining of polymorphic functions in the native-code OCaml compiler. Polymorphic array operations (read and write) in OCaml require runtime type dispatch because of ad hoc memory representations of integer and float arrays. It cannot be removed even after being monomorphized by inlining because the intermedia...
متن کاملFast and Eeective Procedure Inlining
Inlining is an important optimization for programs that use procedural abstraction. Because inlining trades code size for execution speed, the e ectiveness of an inlining algorithm is determined not only by its ability to recognize inlining opportunities but also by its discretion in exercising those opportunities. This paper presents a new inlining algorithm for higher-order languages that com...
متن کاملA Method-Level Analysis of Object-Oriented Techniques in Java Applications
In this paper we seek to provide a foundation for the study of the level of use of object-oriented techniques in Java programs in general, and scientific applications in particular. Specifically, we focus on the use of small methods, and the frequency with which they are called, since this forms the basis for the study of method inlining, an important optimisation technique. We compare the Gran...
متن کاملA Study and Analysis of Function Inlining
Function inlining is a widely known technique which has been used to improve program performance. Inlining replaces a function call by the body of the function. In this report, we study the eeects of inline function expansion by observing the empirical behavior of a set of C and C++ programs. Our results indicate that for the average C program improvements in timings due to inlining are not muc...
متن کاملStatistical Analysis of Inlining Heuristics in Jikes RVM
While inlining is one of the heavily used optimizations for compiling Java programs, its overly aggressive usage can actually hurt the program performance. Therefore, the inlining heuristics used in various Java virtual machines need to be appropriately tuned in order to maximize inlining benefits without introducing its potential cost. However, the current tuning process is usually performed m...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2012