public
Last active

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
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() {

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.