2010 · 27 citations · 16 references
ComputingComputer ScienceCompilersProgramming LanguagesSystems ProgrammingAbstract Syntax TreesCompiler ConstructionData TypesGeneric ProgrammingType CheckingType SystemsCode OptimizationCompiler SupportGeneric FunctionsGeneric TypesRuntime SpecializationType-level Programming
Datatype-generic programming increases program reliability by reducing code duplication and enhancing reusability and modularity. Several generic programming libraries for Haskell have been developed in the past few years. These libraries have been compared 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 extensive benchmark suite for generic functions and analyze the potential for automatic code optimization at compilation time. Our benchmark confirms that generic programs, when compiled with the standard optimization flags of the Glasgow Haskell Compiler (GHC), are substantially slower than their hand-written counterparts. However, 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.
16
Template meta-programming for Haskell
Tim Sheard, Simon Peyton Jones · 2002 · 548 citations
Ralf Lämmel, Simon Peyton Jones · 2003 · 350 citations