z-logo
open-access-imgOpen Access
Optimizing generics is easy!
Author(s) -
José Pedro Magalhães,
Stefan Holdermans,
Johan Jeuring,
Andres Löh
Publication year - 2010
Publication title -
citeseer x (the pennsylvania state university)
Language(s) - English
Resource type - Conference proceedings
DOI - 10.1145/1706356.1706366
Subject(s) - computer science , haskell , programming language , compiler , benchmark (surveying) , modularity (biology) , code (set theory) , suite , compile time , optimizing compiler , code generation , reusability , parallel computing , functional programming , operating system , software , history , geodesy , set (abstract data type) , archaeology , key (lock) , biology , genetics , geography
Datatype-generic programming increases program reliability by re- ducing code duplication and enhancing reusability and modular- ity. Several generic programming libraries for Haskell have been developed in the past few years. These libraries have been com- pared in detail with respect to expressiveness, extensibility, typing issues, etc., but performance comparisons have been brief, limited, and preliminary. It is widely believed that generic programs run slower than hand-written code. In this paper we present an exten- sive benchmark suite for generic functions and analyze the potential for automatic code optimization at compilation time. Our bench- mark confirms that generic programs, when compiled with the stan- dard optimization flags of the Glasgow Haskell Compiler (GHC), are substantially slower than their hand-written counterparts. How- ever, we also find that more advanced optimization capabilities of GHC can be used to further optimize generic functions, sometimes achieving the same efficiency as hand-written code.

The content you want is available to Zendy users.

Already have an account? Click here to sign in.
Having issues? You can contact us here
Accelerating Research

Address

John Eccles House
Robert Robinson Avenue,
Oxford Science Park, Oxford
OX4 4GP, United Kingdom