Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Basically all the programs that use collections at all? Of the first 7 programs that I checked, 6 use primitive arrays, and N-body uses an array but that array contains a pointer type. Fannkuch-redux, meteor contest, fasta, spectral-norm, reverse complement, mandelbrot ... all use primitive arrays. A better question would be: which programs do NOT use primitive arrays? I'm not saying that these should be written using ArrayList or something, just that they are not very indicative of real world performance when people are more likely to use the collection classes.


You seem to have noticed the arrays of primitives, and not noticed the other collections:

fannkuch-redux is all about "Indexed-access to tiny integer-sequence" so it really is all int[]

meteor-contest int[] byte[] OkPieces[] SPiece[] Piece[]

fasta byte[] double[] frequency[]

spectral-norm double[] Approximate[]

reverse-complement byte[] int[] ArrayList<byte[]> LinkedList<Integer>

mandelbrot byte[][] double[] Thread[]

and then the ones you didn't mention:

binary-trees custom binary trees

chameneos-redux ArrayBlockingQueue<Creature> Creature[] Thread[]

knucleotide byte[] int[] LinkedBlockingQueue<AbstractCounter> ArrayList<LinkedBlockingQueue<WorkChunk>> AbstractCounter[] ArrayList<CountString> StringBuilder TreeMap<Integer, Map<Byte, AbstractCounter>> HashSet<AbstractCounter> ByteBuffer ArrayBlockingQueue<Runnable>

pidigits long[] Semaphore[] exec[]

regexdna Thread[] StringBuffer HashMap<String, String>

thread-ring custom ring (also Node[] LinkedList<Node>)


>> not very indicative of real world performance when people are more likely to use the collection classes <<

That doesn't seem much more than a big fat assumption - aren't there also going to be many situations when the right thing to do is use an array?


That people use standard collection classes more often than in these benchmarks where they little used (if at all) is a big fat assumption?! There are going to be many situations where using a primitive array is not the right choice. When you need a hash table, a set or an expandable array, for example. If you are claiming that these benchmarks are indicative of the real world, you are claiming that collection classes are not used in the real world, since hardly any (if any) use the built in collections.


>> If you are claiming that... <<

What I'm doing is responding to your claim -- write everything directly on top of primitive arrays (as is done on the shootout).

>> When you need a hash table <<

Task description from the home page -- "Repeatedly update hashtables and k-nucleotide strings"


> aren't there also going to be many situations when the right thing to do is use an array?

Sure, with a language that has super slow boxing semantics....

Just look at BinaryTree. The benchmark would show a very different picture if it would compare Tree<Integer> implementations instead of allowing a primitive int.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: