Reviewers: ,

Message:
The benchmark below goes from ~10000 us to ~6000 us.
There does not appear to be a good benchmark for sorting on golem.
celtickane-array improves by a few percent.
http://spartan0.spb:9013/v8/r8424-v8-sra-scaled-try-3-base.html

I have tried to make the platform/compiler dependent parts work but I have no
way to build on anything but Goobuntu.  I did test default version of
IntegerLog2.

I tried uploading win7 and arm variants to golem but they never get built.


Benchmark:

function setup() {
  var a = [];
  for (var i = 0; i < 10000; i++) a[i] = i;
  return a;
}

// Reversible transformation: sign extend the low byte and xor into the high
// bits.
function flip(x) { return x ^ (((x & 127) - (x & 128)) << 23); }

function benchmark(a) {
  // Alternate passes sort small numbers and mixed large and small numbers.
  for (var i = 0; i < a.length; i++) a[i] = flip(a[i]);
  a.sort();
}

var arr = setup();
var elapsed = 0;
var start = new Date();
for (var n = 0; elapsed < 2000; n++) {
  benchmark(arr);
  elapsed = new Date() - start;
}
print('Time (sort-smi): ' + Math.floor(1000 * elapsed/n) + ' us.');


Description:
Improvement to SmiLexicalCompare

If two positive Smis have the same number of decimal digits the
lexical order is the same as the numeric order.  Values with different
numbers of decimal digits are compared by pre-scaling with some power
of 10 to make the number of digits the same.

This approach avoids the expensive digit generation loop of the
previous approach.

Please review this at http://codereview.chromium.org/7261008/

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
  A     src/misc-intrinsics.h
  M     src/runtime.h
  M     src/runtime.cc


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to