
30 Mar
2011
30 Mar
'11
1:56 p.m.
Maybe, we should stop using Int altogether. Why not use Integer if we want integers, and try to implement Integer and its operations more efficiently? Int8, Int16, Int32, and Int64 are good when doing system programming, CInt is good when interfacing with C, but what is Int good for?
It's good for big data structures since it can be unpacked into the constructor. I've seen space usage go down by 1/3 after an Integer -> Int switch. Integer is a sum type so there's an extra two words of overhead (if not mistaken, one for the tag, and one for the indirection since it can't unpack).