One of my projects involving gene sequence alignment uses a large amount of big linear vectors of integers and floats. I have noticed in
Java that if I am using a language provided vector (such as a[] ) the speed improves significantly as when using the implemented collections classes (List, Set, Vector). Also, by using primitive types (such as int, long) the speed improves up to 10 times as when using language classes (Integer, Long, Float). The reason is simple, each Integer is an instance of a class, residing in its own dynamically allocated memory area.
Regarding Ruby, how does Ruby manage the primitive types? I understand that the programmer sees them as classes, but internally, how much memory areas are allocated for example if one builds a vector of 1000 integers? Is this one, as in int[1000] in Java, or 1001 as of Integer[1000]: the array object and the 1000 Integer objects?