From cc398a1b15010cf59588749cf06eb7e2ecd37421 Mon Sep 17 00:00:00 2001 From: "pschwartau%netscape.com" Date: Mon, 8 Dec 2003 18:59:19 +0000 Subject: [PATCH] Initial add. JS shell performance test by mazielobo@netscape.com. git-svn-id: svn://10.0.0.236/trunk@150148 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/js/perf/tests/array/concat-001.js | 101 +++++++++ mozilla/js/perf/tests/array/create-001.js | 69 ++++++ mozilla/js/perf/tests/array/create-002.js | 117 ++++++++++ mozilla/js/perf/tests/array/create-003.js | 117 ++++++++++ mozilla/js/perf/tests/array/join-001.js | 97 +++++++++ mozilla/js/perf/tests/array/pop-001.js | 71 ++++++ mozilla/js/perf/tests/array/push-001.js | 84 ++++++++ mozilla/js/perf/tests/array/reverse-001.js | 78 +++++++ mozilla/js/perf/tests/array/shift-001.js | 104 +++++++++ mozilla/js/perf/tests/array/slice-001.js | 84 ++++++++ mozilla/js/perf/tests/array/sort-001.js | 149 +++++++++++++ mozilla/js/perf/tests/array/splice-001.js | 118 ++++++++++ mozilla/js/perf/tests/array/toSource-001.js | 93 ++++++++ mozilla/js/perf/tests/array/toString-001.js | 93 ++++++++ mozilla/js/perf/tests/array/unshift-001.js | 93 ++++++++ mozilla/js/perf/tests/array/valueOf-001.js | 82 +++++++ mozilla/js/perf/tests/boolean/create-001.js | 62 ++++++ mozilla/js/perf/tests/boolean/toSource-001.js | 69 ++++++ mozilla/js/perf/tests/boolean/toString-001.js | 69 ++++++ mozilla/js/perf/tests/boolean/valueOf-001.js | 67 ++++++ mozilla/js/perf/tests/date/UTC-001.js | 104 +++++++++ mozilla/js/perf/tests/date/UTC-002.js | 112 ++++++++++ mozilla/js/perf/tests/date/create-001.js | 62 ++++++ mozilla/js/perf/tests/date/create-002.js | 132 ++++++++++++ mozilla/js/perf/tests/date/create-003.js | 103 +++++++++ mozilla/js/perf/tests/date/create-004.js | 93 ++++++++ mozilla/js/perf/tests/date/getMethods-001.js | 154 +++++++++++++ mozilla/js/perf/tests/date/getMethods-002.js | 155 +++++++++++++ mozilla/js/perf/tests/date/getMethods-003.js | 154 +++++++++++++ .../js/perf/tests/date/getUTCMethods-001.js | 127 +++++++++++ .../js/perf/tests/date/getUTCMethods-002.js | 127 +++++++++++ .../js/perf/tests/date/getUTCMethods-003.js | 128 +++++++++++ mozilla/js/perf/tests/date/parse-001.js | 83 +++++++ mozilla/js/perf/tests/date/setMethods-001.js | 203 ++++++++++++++++++ mozilla/js/perf/tests/date/setMethods-002.js | 137 ++++++++++++ mozilla/js/perf/tests/date/setMethods-003.js | 129 +++++++++++ .../js/perf/tests/date/setUTCMethods-001.js | 177 +++++++++++++++ .../js/perf/tests/date/setUTCMethods-002.js | 136 ++++++++++++ .../js/perf/tests/date/setUTCMethods-003.js | 129 +++++++++++ mozilla/js/perf/tests/date/toGMTString-001.js | 111 ++++++++++ .../js/perf/tests/date/toLocaleString-001.js | 111 ++++++++++ mozilla/js/perf/tests/date/toSource-001.js | 111 ++++++++++ mozilla/js/perf/tests/date/toString-001.js | 111 ++++++++++ mozilla/js/perf/tests/date/toUTCString-001.js | 111 ++++++++++ mozilla/js/perf/tests/date/valueOf-001.js | 67 ++++++ mozilla/js/perf/tests/function/create-001.js | 71 ++++++ mozilla/js/perf/tests/math/abs-001.js | 118 ++++++++++ mozilla/js/perf/tests/math/acos-001.js | 141 ++++++++++++ mozilla/js/perf/tests/math/asin-001.js | 140 ++++++++++++ mozilla/js/perf/tests/math/atan-001.js | 138 ++++++++++++ mozilla/js/perf/tests/math/atan2-001.js | 125 +++++++++++ mozilla/js/perf/tests/math/ceil-001.js | 118 ++++++++++ mozilla/js/perf/tests/math/cos-001.js | 136 ++++++++++++ .../js/perf/tests/math/exactnumbers-001.js | 117 ++++++++++ mozilla/js/perf/tests/math/exp-001.js | 119 ++++++++++ mozilla/js/perf/tests/math/floor-001.js | 118 ++++++++++ mozilla/js/perf/tests/math/log-001.js | 136 ++++++++++++ mozilla/js/perf/tests/math/max-001.js | 136 ++++++++++++ mozilla/js/perf/tests/math/min-001.js | 135 ++++++++++++ mozilla/js/perf/tests/math/pow-001.js | 137 ++++++++++++ mozilla/js/perf/tests/number/create-001.js | 72 +++++++ mozilla/js/perf/tests/object/create-001.js | 72 +++++++ mozilla/js/perf/tests/object/toSource-001.js | 108 ++++++++++ mozilla/js/perf/tests/object/toString-001.js | 89 ++++++++ mozilla/js/perf/tests/regexp/create-001.js | 75 +++++++ mozilla/js/perf/tests/string/create-001.js | 72 +++++++ 66 files changed, 7257 insertions(+) create mode 100644 mozilla/js/perf/tests/array/concat-001.js create mode 100644 mozilla/js/perf/tests/array/create-001.js create mode 100644 mozilla/js/perf/tests/array/create-002.js create mode 100644 mozilla/js/perf/tests/array/create-003.js create mode 100644 mozilla/js/perf/tests/array/join-001.js create mode 100644 mozilla/js/perf/tests/array/pop-001.js create mode 100644 mozilla/js/perf/tests/array/push-001.js create mode 100644 mozilla/js/perf/tests/array/reverse-001.js create mode 100644 mozilla/js/perf/tests/array/shift-001.js create mode 100644 mozilla/js/perf/tests/array/slice-001.js create mode 100644 mozilla/js/perf/tests/array/sort-001.js create mode 100644 mozilla/js/perf/tests/array/splice-001.js create mode 100644 mozilla/js/perf/tests/array/toSource-001.js create mode 100644 mozilla/js/perf/tests/array/toString-001.js create mode 100644 mozilla/js/perf/tests/array/unshift-001.js create mode 100644 mozilla/js/perf/tests/array/valueOf-001.js create mode 100644 mozilla/js/perf/tests/boolean/create-001.js create mode 100644 mozilla/js/perf/tests/boolean/toSource-001.js create mode 100644 mozilla/js/perf/tests/boolean/toString-001.js create mode 100644 mozilla/js/perf/tests/boolean/valueOf-001.js create mode 100644 mozilla/js/perf/tests/date/UTC-001.js create mode 100644 mozilla/js/perf/tests/date/UTC-002.js create mode 100644 mozilla/js/perf/tests/date/create-001.js create mode 100644 mozilla/js/perf/tests/date/create-002.js create mode 100644 mozilla/js/perf/tests/date/create-003.js create mode 100644 mozilla/js/perf/tests/date/create-004.js create mode 100644 mozilla/js/perf/tests/date/getMethods-001.js create mode 100644 mozilla/js/perf/tests/date/getMethods-002.js create mode 100644 mozilla/js/perf/tests/date/getMethods-003.js create mode 100644 mozilla/js/perf/tests/date/getUTCMethods-001.js create mode 100644 mozilla/js/perf/tests/date/getUTCMethods-002.js create mode 100644 mozilla/js/perf/tests/date/getUTCMethods-003.js create mode 100644 mozilla/js/perf/tests/date/parse-001.js create mode 100644 mozilla/js/perf/tests/date/setMethods-001.js create mode 100644 mozilla/js/perf/tests/date/setMethods-002.js create mode 100644 mozilla/js/perf/tests/date/setMethods-003.js create mode 100644 mozilla/js/perf/tests/date/setUTCMethods-001.js create mode 100644 mozilla/js/perf/tests/date/setUTCMethods-002.js create mode 100644 mozilla/js/perf/tests/date/setUTCMethods-003.js create mode 100644 mozilla/js/perf/tests/date/toGMTString-001.js create mode 100644 mozilla/js/perf/tests/date/toLocaleString-001.js create mode 100644 mozilla/js/perf/tests/date/toSource-001.js create mode 100644 mozilla/js/perf/tests/date/toString-001.js create mode 100644 mozilla/js/perf/tests/date/toUTCString-001.js create mode 100644 mozilla/js/perf/tests/date/valueOf-001.js create mode 100644 mozilla/js/perf/tests/function/create-001.js create mode 100644 mozilla/js/perf/tests/math/abs-001.js create mode 100644 mozilla/js/perf/tests/math/acos-001.js create mode 100644 mozilla/js/perf/tests/math/asin-001.js create mode 100644 mozilla/js/perf/tests/math/atan-001.js create mode 100644 mozilla/js/perf/tests/math/atan2-001.js create mode 100644 mozilla/js/perf/tests/math/ceil-001.js create mode 100644 mozilla/js/perf/tests/math/cos-001.js create mode 100644 mozilla/js/perf/tests/math/exactnumbers-001.js create mode 100644 mozilla/js/perf/tests/math/exp-001.js create mode 100644 mozilla/js/perf/tests/math/floor-001.js create mode 100644 mozilla/js/perf/tests/math/log-001.js create mode 100644 mozilla/js/perf/tests/math/max-001.js create mode 100644 mozilla/js/perf/tests/math/min-001.js create mode 100644 mozilla/js/perf/tests/math/pow-001.js create mode 100644 mozilla/js/perf/tests/number/create-001.js create mode 100644 mozilla/js/perf/tests/object/create-001.js create mode 100644 mozilla/js/perf/tests/object/toSource-001.js create mode 100644 mozilla/js/perf/tests/object/toString-001.js create mode 100644 mozilla/js/perf/tests/regexp/create-001.js create mode 100644 mozilla/js/perf/tests/string/create-001.js diff --git a/mozilla/js/perf/tests/array/concat-001.js b/mozilla/js/perf/tests/array/concat-001.js new file mode 100644 index 00000000000..7ee6bf53db7 --- /dev/null +++ b/mozilla/js/perf/tests/array/concat-001.js @@ -0,0 +1,101 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is JavaScript Engine performance test. + * + * The Initial Developer of the Original Code is Netscape Communications Corp. + * Portions created by the Initial Developer are Copyright (C) 2002 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): Mazie Lobo mazielobo@netscape.com + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** + * + * + * + * Date: 04 October 2002 + * SUMMARY: Testing |concat()| method of an Array. It joins two arrays and returns a new array. + */ +//---------------------------------------------------------------------------------------------- +var UBOUND=100000; + +test(); + + +function test() +{ + var u_bound=UBOUND; + var status; + var start; + var end; + var i; + var elt0, elt1,elt2; + var arr0, arr1, arr2; + + + // Arrays are empty + arr0 = new Array(); + arr1 = new Array(); + + status = "concat()- empty arrays\t"; + start = new Date(); + for(i=0; i b) + return 1; + // a must be equal to b + return 0; +} + +//Compares numbers instead of string +function compareNumbers(a, b) +{ + return a - b +} diff --git a/mozilla/js/perf/tests/array/splice-001.js b/mozilla/js/perf/tests/array/splice-001.js new file mode 100644 index 00000000000..1e1c8dd039f --- /dev/null +++ b/mozilla/js/perf/tests/array/splice-001.js @@ -0,0 +1,118 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is JavaScript Engine performance test. + * + * The Initial Developer of the Original Code is Netscape Communications Corp. + * Portions created by the Initial Developer are Copyright (C) 2002 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): Mazie Lobo mazielobo@netscape.com + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** + * + * + * Date: 04 October 2002 + * SUMMARY: Testing |splice()| method of an Array. + * Changes the content of an array, adding new elements while removing old elements. + * + * Syntax: splice(index, howMany, [element1][, ..., elementN]) + * + * Parameters: index - index at which to start changing the array. + * howMany - An integer indicating the number of old array elements to remove. + * If howMany is 0, no elements are removed. In this case, you should specify at least one new element. + * element1, ...,elementN - The elements to add to the array. If you don't specify any elements, + * splice simply removes elements from the array. + */ +//----------------------------------------------------------------------------- +var UBOUND=10000; + +test(); + + +function test() +{ + var u_bound=UBOUND; + var status; + var start; + var end; + var i; + var j; + var elt0, elt1, elt2, elt3, elt4, elt5, elt6, elt7, elt8, elt9; + var elt10, elt11, elt12; + var arr0, arr1; + + + // Array containing 10 elements + arr0 = new Array(elt0, elt1, elt2, elt3, elt4, elt5, elt6, elt7, elt8, elt9); + + // Does not remove an element, but adds an element. + status = "arr0.splice(2,0,elt10)\t\t"; + start = new Date(); + for(i=0; i