Difference between revisions of "Performance/Integers"

From HaskellWiki
Jump to navigation Jump to search
(Some performance comments on Integers)
 
(+cat)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
  +
{{Performance infobox}}
'''Integers'''
 
  +
[[Category:Performance|Integers]]
 
==Integers==
   
 
''Int'' (the machine word-sized integer type) is faster than the arbitrary
 
''Int'' (the machine word-sized integer type) is faster than the arbitrary
Line 5: Line 7:
 
like inner loops.
 
like inner loops.
   
That being said, Haskell (or at least GHC's) ''Integer'' are very fast,
+
That being said, the Haskell (or at least GHC's) implementation of ''Integer'' is very fast,
 
as far as arbitrary precision arithmetic goes.
 
as far as arbitrary precision arithmetic goes.

Latest revision as of 11:31, 13 January 2007

Haskell Performance Resource

Constructs:
Data Types - Functions
Overloading - FFI - Arrays
Strings - Integers - I/O
Floating point - Concurrency
Modules - Monads

Techniques:
Strictness - Laziness
Avoiding space leaks
Accumulating parameter

Implementation-Specific:
GHC - nhc98 - Hugs
Yhc - JHC

Integers

Int (the machine word-sized integer type) is faster than the arbitrary precision Integer type. So don't use Integer in critical places, like inner loops.

That being said, the Haskell (or at least GHC's) implementation of Integer is very fast, as far as arbitrary precision arithmetic goes.