Q.Yang wrote in his e-mail message of 1995/08/23
Getting right to the point, which one of the following lists would consume more memory for GAP? 1) [1,2,3,4,5,6,7] 2) [7060504030201]
Each GAP object (except for small integers, which are represented
immediately) has a 16 byte overhead.
A list occupies 4 bytes for the length and 4 bytes per entry
(plus up to 25% more memory preallocated for future expansions).
A large integer <n> occupies log_2(<n>)/8 bytes, rounded up to
the next multiple of 8 bytes.
So the first list occupies 16 + 4 + 7 * 4 = 48 bytes. And the second list occupies 16 + 4 + 1 * 4 + 16 + 8 = 48 bytes.
Why do you need to know?
Martin.
-- .- .-. - .. -. .-.. --- ...- . ... .- -. -. .. -.- .- Martin Sch"onert, Martin.Schoenert@Math.RWTH-Aachen.DE, +49 241 804551 Lehrstuhl D f"ur Mathematik, Templergraben 64, RWTH, 52056 Aachen, Germany