Skip to content

@mraleph /gist:926906
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
diff --git a/tests/arrays.js b/tests/arrays.js
index 5f6a8c4..4edbdf1 100644
--- a/tests/arrays.js
+++ b/tests/arrays.js
@@ -4,6 +4,8 @@
* Licensed under LGPL-3 (see LICENSE.txt)
*/
var ctx, i, j, randlist,
new_normal, new_imageData, new_arrayBuffer,
browser = Browser.browser + " " +
@@ -228,7 +230,8 @@ testFunc["arrayBuffer_create"] = function() {
return endTime - startTime;
};
-function test_sequentialRead(arr) {
+
+function mk_test_sequentialRead() { return function (arr) {
var i, j, cnt, startTime, endTime;
/* Initialize the array */
copy_randlist(arr);
@@ -246,9 +249,9 @@ function test_sequentialRead(arr) {
endTime = (new Date()).getTime();
return endTime - startTime;
-}
+}; }
-function test_randomRead(arr) {
+function mk_test_randomRead() { return function (arr) {
var i, cnt, startTime, endTime;
/* Initialize the array */
copy_randlist(arr); // used as jumplist
@@ -261,9 +264,9 @@ function test_randomRead(arr) {
endTime = (new Date()).getTime();
return endTime - startTime;
-}
+}; }
-function test_sequentialWrite(arr) {
+function mk_test_sequentialWrite() { return function (arr) {
var i, cnt, startTime, endTime;
/* Initialize the array */
copy_randlist(arr);
@@ -280,56 +283,76 @@ function test_sequentialWrite(arr) {
endTime = (new Date()).getTime();
return endTime - startTime;
+}; }
+
+
+var MAKE_MONOMORPHIC = true;
+
+if (MAKE_MONOMORPHIC) {
+test_sequentialRead_1 = mk_test_sequentialRead();
+test_sequentialRead_2 = mk_test_sequentialRead();
+test_sequentialRead_3 = mk_test_sequentialRead();
+test_randomRead_1 = mk_test_randomRead();
+test_randomRead_2 = mk_test_randomRead();
+test_randomRead_3 = mk_test_randomRead();
+test_sequentialWrite_1 = mk_test_sequentialWrite();
+test_sequentialWrite_2 = mk_test_sequentialWrite();
+test_sequentialWrite_3 = mk_test_sequentialWrite();
+} else {
+test_sequentialRead_1 = test_sequentialRead_2 = test_sequentialRead_3 = mk_test_sequentialRead();
+test_randomRead_1 = test_randomRead_2 = test_randomRead_3 = mk_test_randomRead();
+test_sequentialWrite_1 = test_sequentialWrite_2 = test_sequentialWrite_3 = mk_test_sequentialWrite();
}
+
/* Sequential Read Tests */
testFunc["normal_sequentialRead"] = function() {
vmessage("read normal array " + conf.read_cnt + "x");
- return test_sequentialRead(new_normal());
+ return test_sequentialRead_1(new_normal());
};
testFunc["imageData_sequentialRead"] = function() {
vmessage("read imageData array " + conf.read_cnt + "x");
- return test_sequentialRead(new_imageData());
+ return test_sequentialRead_2(new_imageData());
};
testFunc["arrayBuffer_sequentialRead"] = function() {
vmessage("read arrayBuffer array " + conf.read_cnt + "x");
- return test_sequentialRead(new_arrayBuffer());
+ return test_sequentialRead_3(new_arrayBuffer());
};
/* Random Read Tests */
testFunc["normal_randomRead"] = function() {
vmessage("read normal array " + conf.read_cnt + "x");
- return test_randomRead(new_normal());
+ return test_randomRead_1(new_normal());
};
testFunc["imageData_randomRead"] = function() {
vmessage("read imageData array " + conf.read_cnt + "x");
- return test_randomRead(new_imageData());
+ return test_randomRead_2(new_imageData());
};
testFunc["arrayBuffer_randomRead"] = function() {
vmessage("read arrayBuffer array " + conf.read_cnt + "x");
- return test_randomRead(new_arrayBuffer());
+ return test_randomRead_3(new_arrayBuffer());
};
/* Sequential Write Tests */
testFunc["normal_sequentialWrite"] = function() {
vmessage("write normal array " + conf.write_cnt + "x");
- return test_sequentialWrite(new_normal());
+ return test_sequentialWrite_1(new_normal());
};
testFunc["imageData_sequentialWrite"] = function() {
vmessage("write imageData array " + conf.write_cnt + "x");
- return test_sequentialWrite(new_imageData());
+ return test_sequentialWrite_2(new_imageData());
};
testFunc["arrayBuffer_sequentialWrite"] = function() {
vmessage("write arrayBuffer array " + conf.write_cnt + "x");
- return test_sequentialWrite(new_arrayBuffer());
+ return test_sequentialWrite_3(new_arrayBuffer());
};
init = function() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.