Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2011-07-27 07:08:47 +0400
committerBen Noordhuis <info@bnoordhuis.nl>2011-08-12 20:42:24 +0400
commit47265046632a64fcd2f7c9e50e3c2caa598f51e7 (patch)
treedbd252c3798e5505b8f506895a35652670889c2a /benchmark
parentefcbe3b21a3504cb2fb8516b3e324aa23c8bbc6a (diff)
typed arrays: preliminary benchmarks
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/arrays/var_int.js15
-rw-r--r--benchmark/arrays/zero_float.js15
-rw-r--r--benchmark/arrays/zero_int.js15
3 files changed, 45 insertions, 0 deletions
diff --git a/benchmark/arrays/var_int.js b/benchmark/arrays/var_int.js
new file mode 100644
index 00000000000..17e12989f5e
--- /dev/null
+++ b/benchmark/arrays/var_int.js
@@ -0,0 +1,15 @@
+var types = 'Array Buffer Int8Array Uint8Array Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array'.split(' ');
+
+var type = types[types.indexOf(process.argv[2])];
+if (!type)
+ type = types[0];
+
+console.error('Benchmarking', type);
+var clazz = global[type];
+
+var arr = new clazz(25 * 10e5);
+for (var i = 0; i < 10; ++i) {
+ for (var j = 0, k = arr.length; j < k; ++j) {
+ arr[j] = (j ^ k) & 127;
+ }
+}
diff --git a/benchmark/arrays/zero_float.js b/benchmark/arrays/zero_float.js
new file mode 100644
index 00000000000..bdb8765d0a4
--- /dev/null
+++ b/benchmark/arrays/zero_float.js
@@ -0,0 +1,15 @@
+var types = 'Array Buffer Int8Array Uint8Array Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array'.split(' ');
+
+var type = types[types.indexOf(process.argv[2])];
+if (!type)
+ type = types[0];
+
+console.error('Benchmarking', type);
+var clazz = global[type];
+
+var arr = new clazz(25 * 10e5);
+for (var i = 0; i < 10; ++i) {
+ for (var j = 0, k = arr.length; j < k; ++j) {
+ arr[j] = 0.0;
+ }
+}
diff --git a/benchmark/arrays/zero_int.js b/benchmark/arrays/zero_int.js
new file mode 100644
index 00000000000..17dac62c147
--- /dev/null
+++ b/benchmark/arrays/zero_int.js
@@ -0,0 +1,15 @@
+var types = 'Array Buffer Int8Array Uint8Array Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array'.split(' ');
+
+var type = types[types.indexOf(process.argv[2])];
+if (!type)
+ type = types[0];
+
+console.error('Benchmarking', type);
+var clazz = global[type];
+
+var arr = new clazz(25 * 10e5);
+for (var i = 0; i < 10; ++i) {
+ for (var j = 0, k = arr.length; j < k; ++j) {
+ arr[j] = 0;
+ }
+}