Status: New
Owner: ----

New issue 3533 by [email protected]: DataView methods are 40X slower than corresponding TypedArray methods
https://code.google.com/p/v8/issues/detail?id=3533

Detailed description of the issue.
DataView methods are very slow.

Test case:
var a   = new Float32Array(1000);
var d = new DataView(a.buffer);

function initArray() {
  var j = 0;
  for (var i = 0, l = a.length; i < l; ++i) {
    a[i] = 0.1 * i;
  }
}

function average(n) {
  print('=========== average ===================');
  for (var i = 0; i < n; ++i) {
    var sum = 0.0;
    for (var j = 0, l = a.length; j < l; ++j) {
      sum += a[j];
    }
  }
  print(sum/a.length);
}

var n = 100000;
initArray();
var time = Date.now();
average(n)
var time_typedarray = Date.now() - time;
print(time_typedarray)
time = Date.now();
dataviewAverage(n);
var time_dataview = Date.now() - time;
print(time_dataview)
print('speedup: ', time_typedarray/time_dataview);

In my test, the output is:
=========== average ===================
49.95000000002235
208
=========== dataviewAverage ===========
49.95000000002235
8682
speedup:  0.0239576134531214

DataView is important for unaligned memory access use case.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to