Packing
You should make sure that your data is packed if at all possible:
Developer`PackedArrayQ[testvalues]
False
packedvalues = Developer`ToPackedArray@testvalues;
This at least speeds things a bit (timings in version 7 under Windows):
Do[Round[testvalues, 0.1], {10^5}] // AbsoluteTiming
Do[Round[packedvalues, 0.1], {10^5}] // AbsoluteTiming
{7.0500098, Null}
{6.0500085, Null}
In version 9, and possibly 8, you should see a much greater improvement from packing that I experienced here in version 7. Other users are reporting well over an order of magnitude improvement in later versions.
Note that if you had generated the values with RandomReal[1, {100, 2}] they would have been packed to start with.
Data shape
In version 7, where the Round operation is handled by the Mathematica Kernel rather than the Intel MKL transposing the values before rounding makes a considerable difference:
Do[Round[packedvalues\[Transpose], 0.1]\[Transpose], {10^5}] // AbsoluteTiming
{3.8900054, Null}
SetAccuracy
Also applicable to version 7, an alternative that may be acceptable it is to use SetAccuracy which on my system this about twice as fast:
tvalues = packedvalues\[Transpose];
Do[SetAccuracy[tvalues, 2], {10^5}] // AbsoluteTiming
{1.7961027, Null}
Note that users of more recent versions will find that Round on a packed array is faster than SetAccuracy.
SeedRandom[42]; testvalues = RandomReal[1., {100, 2}]; For[i = 1, i <= 100000, i++, Round[testvalues, 0.1]]// AbsoluteTimingon my system gives{0.713849, Null}which is way faster than what the OP is seeing. I'm using V.9.0.1 on OS X 10.6.8 on a three year old iMac with a 2.93 MHz i7 iMac. I am very puzzled by the discrepancy. – m_goldberg Sep 19 '13 at 06:40RandomReal[1., {100, 2}]you are producing a packed array. I suspect that v9 (at least) has optimizedRoundfor such cases yielding the better timing. – Mr.Wizard Sep 19 '13 at 06:48