[Haskell] Re: sizeFM type

S. Alexander Jacobson alex at i2x.com
Mon Apr 26 15:25:02 EDT 2004


On Mon, 26 Apr 2004, Robert Will wrote:
> I understand the Int type to be as large as pointers on each kind of
> hardware.  So one cannot possible have any data structure whose size
> doesn't fit in an Int.

If my data structure is created/destroyed lazily,
I don't see why not.  Trivially, [0..2^128].
Or, if my data structure maps to a file in some
way....See my prior post on the annoyance of
hFileSize vs take.

> > > Moreover, it is not clear that the CPU/memory
> > > overhead of returning Integer rather than Int for
> > > sizeFM is sufficiently high to be worth bothering
> > > the programmer about.
>
> Well, Int is built-in to any hardware, while Integer isn't.  Since
> Int/Integer is one of the most used data types in almost any program, the
> difference would be _very_ big.

I'll cite that hoary Hoare quotation here.
"Premature optimization is the root of all evil."

People who need high performance can use
specialized int functions where it is truly
necessary.  Everywhere else it is a waste of
programmer time to force futzing.

-Alex-

_________________________________________________________________
S. Alexander Jacobson                  mailto:me at alexjacobson.com
tel:917-770-6565                       http://alexjacobson.com


More information about the Haskell mailing list