forked from nodejs/node-v0.x-archive
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
typed arrays: preliminary benchmarks
- Loading branch information
1 parent
efcbe3b
commit 4726504
Showing
3 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |