charToIntRepresentation
Regarding Wednesday’s post, I am finding it difficult to believe that an int array is outperforming a char array in some cases. Especially when the code for the int array requires a few extra lines. Am beginning today with a quick sanity check–am cleaning the target with the char array code and running the test again.
UPDATE: the test shows pretty much the same thing (with today’s results being one second slower; clocking in at 19m56s).
I am trying a version of charToIntRepresentation which doesn’t create a temporary array as it does not seem necessary. Let’s hope it beats 1m47s (as per the 4 tandem spectra test case from two days ago).
UPDATE: I am going crazy! these performance results are making no sense. I’m doing things which reduce the number of memory assignments, comparisons, math operations, etc. and the results are getting worse! Not horribly worse (1m50s), but just not better. Am going to try removing the temp int array in the int version of charToIntRepresentation. (update: I’m not surprised this also has added a few seconds to runtime.)
UPDATE: after a few more tests it I am finding that these minor fluctuations are due more to natural performance variations (background processes, etc) than any real fault in the code. I’m switching to the char representation as it is 1) more logical 2) uses less code and 3) appears to, on average, have a minor performance gain.
CODE CHANGE: am removing the “toupper” method from charToIntRepresentation. It is a performance drag and this does not appear to affect our results.