This commit is contained in:
pschwartau%netscape.com 2003-12-08 18:59:19 +00:00
Родитель 037eed19af
Коммит 0712e6f42c
66 изменённых файлов: 7257 добавлений и 0 удалений

Просмотреть файл

@ -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<u_bound; i++)
{
arr2=arr0.concat(arr1)
}
end = new Date();
reportTime(status, start, end);
// Arrays containing 3 uninitialized elements
arr0 = new Array(elt0, elt1, elt2);
arr1 = new Array(elt0, elt1, elt2);
status = "concat()- 3 elements \t";
start = new Date();
for(i=0; i<u_bound; i++)
{
arr2=arr0.concat(arr1)
}
end = new Date();
reportTime(status, start, end);
// Arrays containing 3 elements, each one a string
elt0="ABC";
elt1="DEF";
elt2="GHI";
arr0 = new Array(elt0, elt1, elt2);
arr1 = new Array(elt0, elt1, elt2);
status = "concat()- 3 string elements ";
start = new Date();
for(i=0; i<u_bound; i++)
{
arr2=arr0.concat(arr1)
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,69 @@
/* ***** 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: 02 October 2002
* SUMMARY: Creation of empty array objects using local variables
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound=UBOUND;
var status = 'new Array()';
var start = new Date();
for(var i=0; i<u_bound; i++)
{
var arr = new Array();
}
var end = new Date();
reportTime(status, start, end);
var u_bound=UBOUND;
var status = 'arr=[]\t';
var start = new Date();
for(var i=0; i<u_bound; i++)
{
var arr = [];
}
var end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,117 @@
/* ***** 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: Creation of 1,5,and 10-element array objects.
* In this test case, we leave all array elements uninitialized.
*/
//-----------------------------------------------------------------------------
var UBOUND=100000;
test();
function test()
{
var u_bound=UBOUND;
var elt0, elt1,elt2, elt3, elt4, elt5, elt6, elt7, elt8, elt9;
var status;
var start;
var end;
var i;
// Testing Array constructor - 1 element
status = 'new Array() - 1 element\t';
start = new Date();
for(i=0; i<u_bound; i++)
{
var a = new Array(elt0);
}
end = new Date();
reportTime(status, start, end);
// Testing Array constructor - 5 elements
status = 'new Array() - 5 elements';
start = new Date();
for(i=0; i<u_bound; i++)
{
var a = new Array(elt0, elt1,elt2, elt3, elt4);
}
end = new Date();
reportTime(status, start, end);
// Testing Array constructor - 10 elements
status = 'new Array() - 10 elements';
start = new Date();
for(i=0; i<u_bound; i++)
{
var a = new Array(elt0, elt1,elt2, elt3, elt4, elt5, elt6, elt7, elt8, elt9);
}
end = new Date();
reportTime(status, start, end);
// Testing Array literal - 1 element
status = 'arr=[] - 1 element\t';
start = new Date();
for(i=0; i<u_bound; i++)
{
var arr = [elt0];
}
end = new Date();
reportTime(status, start, end);
// Testing Array literal - 5 elements
status = 'arr=[] - 5 elements\t';
start = new Date();
for(i=0; i<u_bound; i++)
{
var arr = [elt0, elt1,elt2, elt3, elt4];
}
end = new Date();
reportTime(status, start, end);
// Testing Array literal - 10 elements
status = 'arr=[] - 10 elements\t';
start = new Date();
for(i=0; i<u_bound; i++)
{
var arr = [elt0, elt1,elt2, elt3, elt4, elt5, elt6, elt7, elt8, elt9];
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,117 @@
/* ***** 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: Creation of 1,5,and 10-element array objects.
* In this test case, we initialize all the elements as strings.
*/
//-----------------------------------------------------------------------------
var UBOUND=100000;
test();
function test()
{
var u_bound=UBOUND;
var elt0, elt1,elt2, elt3, elt4, elt5, elt6, elt7, elt8, elt9;
var status;
var start;
var end;
var i;
var arr;
// Testing Array constructor - 1 element
status = 'new Array() - 1 element\t';
start = new Date();
for(i=0; i<u_bound; i++)
{
arr = new Array(elt0);
}
end = new Date();
reportTime(status, start, end);
// Testing Array constructor - 5 elements
status = 'new Array() - 5 elements';
start = new Date();
for(i=0; i<u_bound; i++)
{
arr = new Array(elt0, elt1,elt2, elt3, elt4);
}
end = new Date();
reportTime(status, start, end);
// Testing Array constructor - 10 elements
status = 'new Array() - 10 elements';
start = new Date();
for(i=0; i<u_bound; i++)
{
arr = new Array(elt0, elt1,elt2, elt3, elt4, elt5, elt6, elt7, elt8, elt9);
}
end = new Date();
reportTime(status, start, end);
// Testing Array literal - 1 element
status = 'arr=[] - 1 element\t';
start = new Date();
for(i=0; i<u_bound; i++)
{
arr = [elt0];
}
end = new Date();
reportTime(status, start, end);
// Testing Array literal - 5 elements
status = 'arr=[] - 5 elements\t';
start = new Date();
for(i=0; i<u_bound; i++)
{
arr = [elt0, elt1,elt2, elt3, elt4];
}
end = new Date();
reportTime(status, start, end);
// Testing Array literal - 10 elements
status = 'arr=[] - 10 elements\t';
start = new Date();
for(i=0; i<u_bound; i++)
{
arr = [elt0, elt1,elt2, elt3, elt4, elt5, elt6, elt7, elt8, elt9];
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,97 @@
/* ***** 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 |join()| method of an Array size of 3 and 10.
* In this testcase, all the array elements are uninitialized.
*/
//-----------------------------------------------------------------------------
var UBOUND=100000;
test();
function test()
{
var u_bound=UBOUND;
var status;
var start;
var end;
var i;
var elt0, elt1, elt2, elt3, elt4, elt5, elt6, elt7, elt8, elt9;
var arr;
arr = new Array(elt0, elt1, elt2);
status = "3 elements; join() \t";
start = new Date();
for(i=0; i<u_bound; i++)
{
arr.join();
}
end = new Date();
reportTime(status, start, end);
status = "3 elements; join(':') ";
start = new Date();
for(i=0; i<u_bound; i++)
{
arr.join(':');
}
end = new Date();
reportTime(status, start, end);
arr = new Array(elt0, elt1, elt2, elt3, elt4, elt5, elt6, elt7, elt8, elt9);
status = "10 elements; join() \t";
start = new Date();
for(i=0; i<u_bound; i++)
{
arr.join();
}
end = new Date();
reportTime(status, start, end);
status = "10 elements; join(':') ";
start = new Date();
for(i=0; i<u_bound; i++)
{
arr.join(':');
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,71 @@
/* ***** 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 |pop()| method on an Array of size 3.
* It removes the last element from an array and returns that element.
* This method changes the length of the array.
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound=UBOUND;
var status;
var start;
var end;
var i;
var j;
var arr0 = new Array('element0', 'element1','element2');
var arr1 = arr0;
status = "pop() ";
start = new Date();
for(i=0; i<u_bound; i++)
{
for(j=0; j<2; j++)
{
arr1.pop();
}
arr1=arr0;
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,84 @@
/* ***** 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 |push()| method of an Array.
* It adds one or more elements to the end of an array and
* returns the new length of the array. This method changes
* the length of the array.
*/
//-----------------------------------------------------------------------------
var UBOUND=100000;
test();
function test()
{
var u_bound=UBOUND;
var status;
var start;
var end;
var i;
var elt0, elt1, elt2, elt3, elt4, elt5, elt6, elt7;
var elt8, elt9, elt10, elt11, elt12, elt13, elt14;
var arr, arrPush1, arrPush5;
arr = new Array(elt0, elt1, elt2, elt3, elt4, elt5, elt6, elt7, elt8, elt9);
status = "push() - 1 element";
start = new Date();
for(i=0; i<u_bound; i++)
{
arrPush1=arr.push(elt10);
}
end = new Date();
reportTime(status, start, end);
// Free memory.
gc();
arr = new Array(elt0, elt1, elt2, elt3, elt4, elt5, elt6, elt7, elt8, elt9);
status = "push() - 5 elements";
start = new Date();
for(i=0; i<u_bound; i++)
{
arrPush5=arr.push(elt10, elt11, elt12, elt13, elt14);
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,78 @@
/* ***** 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 |reverse()| method of an Array.
* Transposes the elements of an array: the first array element
* becomes the last and the last becomes the first.
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound=UBOUND;
var status;
var start;
var end;
var i;
var elt0, elt1, elt2, elt3, elt4;
// Array reverses 2 elements
var arr = new Array(elt0, elt1)
status = "reverse() - 2 elements";
start = new Date();
for(i=0; i<u_bound; i++)
{
arr.reverse();
}
end = new Date();
reportTime(status, start, end);
// Array reverses 5 elements
var arr = new Array(elt0, elt1, elt2, elt3, elt4)
status = "reverse() - 5 elements";
start = new Date();
for(i=0; i<u_bound; i++)
{
arr.reverse();
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,104 @@
/* ***** 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 |shift()| method of an Array.
* Removes the first element from an array and returns that element.
* This method changes the length of the array.
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
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 arr0, arr1;
// shift array containing 1 elements
arr0 = new Array(elt0)
arr1=arr0;
status = "shift() - 1 element";
start = new Date();
for(i=0; i<u_bound; i++)
{
arr1.shift();
arr1=arr0;
}
end = new Date();
reportTime(status, start, end);
// shift array containing 5 elements
arr0 = new Array(elt0, elt1, elt2, elt3, elt4);
arr1=arr0;
status = "shift() - 5 elements";
start = new Date();
for(i=0; i<u_bound; i++)
{
for(j=0; j<4; j++)
{
arr1.shift();
}
arr1=arr0;
}
end = new Date();
reportTime(status, start, end);
// shift array containing 10 elements
arr0 = new Array(elt0, elt1, elt2, elt3, elt4, elt5, elt6, elt7, elt8, elt9);
arr1 = arr0;
status = "shift() - 10 elements";
start = new Date();
for(i=0; i<u_bound; i++)
{
for(j=0; j<9; j++)
{
arr1.shift();
}
arr1=arr0;
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,84 @@
/* ***** 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 |slice()| method of an Array.
* Extracts a section of an array and returns a new array.
* |slice()| does not alter the original array, but returns a new
* "one level deep" copy that contains copies of the elements sliced
* from the original array.
*
* Syntax: slice(begin[,end])
*/
//-----------------------------------------------------------------------------
var UBOUND=100000;
test();
function test()
{
var u_bound=UBOUND;
var status;
var start;
var end;
var i;
var elt0, elt1, elt2, elt3, elt4, elt5, elt6, elt7, elt8, elt9;
var arr;
// Array containing 5 elements
arr = new Array(elt0, elt1, elt2, elt3, elt4);
status = "slice() - 5 elements";
start = new Date();
for(i=0;i<u_bound; i++)
{
arr.slice(1,3);
}
end = new Date();
reportTime(status, start, end);
// Array containing 10 elements
arr = new Array(elt0, elt1, elt2, elt3, elt4, elt5, elt6, elt7, elt8, elt9);
status = "slice() - 10 elements";
start = new Date();
for(i=0;i<u_bound; i++)
{
arr.slice(2,8);
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,149 @@
/* ***** 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: 07 October 2002
* SUMMARY: Testing |sort()| method of an Array.
* Sorts the elements of an array. If compareFunction is not supplied,
* elements are sorted by converting them to strings and comparing strings
* in lexicographic ("dictionary" or "telephone book," not numerical) order.
* For example, "80" comes before "9" in lexicographic order, but in a numeric
* sort 9 comes before 80.
*
* Syntax: sort(compareFunction)
*
* Parameters: compareFunction - Specifies a function that defines
* the sort order. If omitted, the array is sorted lexicographically
* (in dictionary order) according to the string conversion of each element.
*/
//-----------------------------------------------------------------------------
var UBOUND=100000;
test();
function test()
{
var u_bound=UBOUND;
var status;
var start;
var end;
var i;
// Array containing 8 string elements. Using function that compares strings
var arrString = new Array("zebra", "dog", "elephant", "monkey", "cat", "pig", "tiger", "lion")
status = "arrString.sort(compareStrings)\t";
start = new Date();
for(i=0;i<u_bound; i++)
{
arrString.sort(compareStrings);
}
end = new Date();
reportTime(status, start, end);
// Array containing 8 numerical String elements. Using function that compares strings
var arrNumStr = new Array("25", "80", "12", "97", "5", "42", "0", "74")
status = "arrNumStr.sort(compareStrings)\t";
start = new Date();
for(i=0;i<u_bound; i++)
{
arrNumStr.sort(compareStrings);
}
end = new Date();
reportTime(status, start, end);
// Array containing 8 numerical elements. Using function that compares strings
var arrNumber = new Array(25, 80, 12, 97, 5, 42, 0, 74)
status = "arrNumber.sort(compareStrings)\t";
start = new Date();
for(i=0;i<u_bound; i++)
{
arrNumber.sort(compareStrings);
}
end = new Date();
reportTime(status, start, end);
// Array containing 8 numerical elements. Using function that compares numbers
arrNumber = new Array(25, 80, 12, 97, 5, 42, 0, 74)
status = "arrNumber.sort(compareNumbers)";
start = new Date();
for(i=0;i<u_bound; i++)
{
arrNumber.sort(compareNumbers);
}
end = new Date();
reportTime(status, start, end);
// Array containing 8 mixed numerical and string elements. Using function that compares strings
var arrMixed = new Array(25, 80, 12, 97, "5", "42", "0", "74")
status = "arrMixed.sort(compareStrings)\t";
start = new Date();
for(i=0;i<u_bound; i++)
{
arrMixed.sort(compareStrings);
}
end = new Date();
reportTime(status, start, end);
// Array containing 8 mixed numerical and string elements. Using function that compares numbers
arrMixed = new Array(25, 80, 12, 97, "5", "42", "0", "74")
status = "arrMixed.sort(compareNumbers)";
start = new Date();
for(i=0;i<u_bound; i++)
{
arrMixed.sort(compareNumbers);
}
end = new Date();
reportTime(status, start, end);
}
//Compares strings
function compareStrings(a, b)
{
if (a < b )
return -1
if (a > b)
return 1;
// a must be equal to b
return 0;
}
//Compares numbers instead of string
function compareNumbers(a, b)
{
return a - b
}

Просмотреть файл

@ -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<u_bound; i++)
{
arr0.splice(2,0,elt10);
}
end = new Date();
reportTime(status, start, end);
// Removes an element, but does not add an element
arr0 = new Array(elt0, elt1, elt2, elt3, elt4, elt5, elt6, elt7, elt8, elt9);
arr1=arr0
status = "arr1.splice(3,1) \t\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
for(j=0;j<9; j++)
{
arr1.splice(3,1);
}
arr1=arr0;
}
end = new Date();
reportTime(status, start, end);
// Removes an element, and replaces an element
arr0 = new Array(elt0, elt1, elt2, elt3, elt4, elt5, elt6, elt7, elt8, elt9);
status = "arr0.splice(2,1,'abc') \t\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
arr0.splice(2,1,elt10);
}
end = new Date();
reportTime(status, start, end);
// Removes an element, and replaces it with 3 elements
arr0 = new Array(elt0, elt1, elt2, elt3, elt4, elt5, elt6, elt7, elt8, elt9);
status = 'arr0.splice(0,2,"abc","def","ghi")';
start = new Date();
for(i=0; i<u_bound; i++)
{
arr0.splice(0,2,elt10,elt11,elt12);
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,93 @@
/* ***** 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: 07 October 2002
* SUMMARY: Testing |toSource()| method of an Array size of 1,5, and 10.
* Returns a string representing the source code of the array.
*
* Syntax:toSource()
*
* Parameters:None
*/
//-----------------------------------------------------------------------------
var UBOUND=100000;
test();
function test()
{
var u_bound=UBOUND;
var status;
var start;
var end;
var i;
var elt0, elt1, elt2, elt3, elt4, elt5, elt6, elt7, elt8, elt9;
var arr;
// Array containing 1 element
arr = new Array(elt0)
status = "toSource() - 1 element\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
arr.toSource();
}
end = new Date();
reportTime(status, start, end);
// Array containing 5 elements
arr = new Array(elt0, elt1, elt2, elt3, elt4);
status = "toSource() - 5 elements\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
arr.toSource();
}
end = new Date();
reportTime(status, start, end);
// Array containing 10 elements
arr = new Array(elt0, elt1, elt2, elt3, elt4, elt5, elt6, elt7, elt8, elt9);
status = "toSource() - 10 elements";
start = new Date();
for(i=0; i<u_bound; i++)
{
arr.toSource();
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,93 @@
/* ***** 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: 07 October 2002
* SUMMARY: Testing |toString()| method of an Array size of 1,5, and 10.
* Returns a string representing the specified array and its elements.
*
* Syntax:toString()
*
* Parameters:None
*/
//-----------------------------------------------------------------------------
var UBOUND=100000;
test();
function test()
{
var u_bound=UBOUND;
var status;
var start;
var end;
var i;
var elt0, elt1, elt2, elt3, elt4, elt5, elt6, elt7, elt8, elt9;
var arr;
// Array containing 1 element
arr = new Array(elt0)
status = "toString() - 1 element\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
arr.toString();
}
end = new Date();
reportTime(status, start, end);
// Array containing 5 elements
arr = new Array(elt0, elt1, elt2, elt3, elt4);
status = "toString() - 5 elements\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
arr.toString();
}
end = new Date();
reportTime(status, start, end);
// Array containing 10 elements
arr = new Array(elt0, elt1, elt2, elt3, elt4, elt5, elt6, elt7, elt8, elt9);
status = "toString() - 10 elements";
start = new Date();
for(i=0; i<u_bound; i++)
{
arr.toString();
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,93 @@
/* ***** 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 |unshift()| method of an Array.
* Adds one or more elements to the beginning of an array and returns
* the new length of the array.
*
* Syntax: arrayName.unshift(element1,..., elementN)
*/
//-----------------------------------------------------------------------------
var UBOUND=1000; // Tried 10,000 but that took a lot of time/memory.
test();
function test()
{
var u_bound=UBOUND;
var status;
var start;
var end;
var i;
var elt0, elt1, elt2, elt3, elt4, elt5, elt6, elt7, elt8, elt9;
var elt10, elt11, elt12, elt13, elt14;
var arr;
// Array containing 5 elements and adding 1 elements
arr = new Array(elt0, elt1, elt2, elt3, elt4);
status = "unshift() - add 1 element";
start = new Date();
for(i=0; i<u_bound; i++)
{
arr.unshift(elt10);
}
end = new Date();
reportTime(status, start, end);
// Array containing 5 elements and adding 5 elements
arr = new Array(elt0, elt1, elt2, elt3, elt4);
status = "unshift() - add 5 elements";
start = new Date();
for(i=0; i<u_bound; i++)
{
arr.unshift(elt5, elt6 , elt7, elt8, elt9);
}
end = new Date();
reportTime(status, start, end);
// Array containing 5 elements and adding 10 elements
arr = new Array(elt0, elt1, elt2, elt3, elt4);
status = "unshift() - add 10 elements";
start = new Date();
for(i=0; i<u_bound; i++)
{
arr.unshift(elt5, elt6, elt7, elt8, elt9, elt10, elt11, elt12, elt13, elt14);
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,82 @@
/* ***** 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 |valueOf()| method of an Array.
* Returns the primitive value of an array.
*
* Syntax: valueOf()
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound=UBOUND;
var status;
var start;
var end;
var i;
var arr;
// Array containing 5 elements
arr = new Array("a", "b", "c", "d", "e");
status = "valueOf()-string";
start = new Date();
for(i=0; i<u_bound; i++)
{
arr.valueOf();
}
end = new Date();
reportTime(status, start, end);
// Array containing 5 elements
arr = new Array(1, 2, 3, 4, 5)
status = "valueOf()-string";
start = new Date();
for(i=0; i<u_bound; i++)
{
arr.valueOf();
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,62 @@
/* ***** 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: 07 October 2002
* SUMMARY: Creation of empty boolean objects using local variables
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound=UBOUND;
var status;
var bool;
var start;
var end;
var i;
status = 'new Boolean("")';
start = new Date();
for(var i=0; i<u_bound; i++)
{
bool = new Boolean("");
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,69 @@
/* ***** 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: 07 October 2002
* SUMMARY: Testing |toSource()| method of a Boolean object
* Returns a string representing the source code of the boolean object.
*
* Syntax:toSource()
*
* Parameters:None
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound=UBOUND;
var status;
var start;
var end;
var i;
var bool;
status = "toSource()";
bool = new Boolean("");
start = new Date();
for(i=0; i<u_bound; i++)
{
bool.toSource();
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,69 @@
/* ***** 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: 07 October 2002
* SUMMARY: Testing |toString()| method of a boolean object.
* Returns a string representing the specified boolean object
*
* Syntax:toString()
*
* Parameters:None
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound=UBOUND;
var status;
var start;
var end;
var i;
var bool;
status = "toString()";
bool = new Boolean("");
start = new Date();
for(i=0; i<u_bound; i++)
{
bool.toString();
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,67 @@
/* ***** 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 |valueOf()| method of a boolean object
* Returns the primitive value of a boolean object.
*
* Syntax: valueOf()
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound=UBOUND;
var status;
var start;
var end;
var i;
var bool;
status = "valueOf()-string";
bool = new Boolean("");
start = new Date();
for(i=0; i<u_bound; i++)
{
bool.valueOf();
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,104 @@
/* ***** 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: 11 October 2002
* SUMMARY: Using the |UTC()| method for the |Date()| object.
* Converts a date to a string, using the universal time convention.
* UTC takes comma-delimited date parameters and returns the number of
* milliseconds between January 1, 1970, 00:00:00, universal time and
* the time you specified.
*
* Syntax: |Date.UTC(year, month, day[, hrs, min, sec, ms])|
* year - A year after 1900.
* month - An integer between 0 and 11 representing the month.
* date - An integer between 1 and 31 representing the day of the month.
* hrs - An integer between 0 and 23 representing the hours.
* min - An integer between 0 and 59 representing the minutes.
* sec - An integer between 0 and 59 representing the seconds.
* ms - An integer between 0 and 999 representing the milliseconds.
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
var year = 2002;
var month = 1;
var day = 1;
status = "Date.UTC(year, month, day) ";
start = new Date();
for(i=0; i<u_bound; i++)
{
Date.UTC(year,month,day);
}
end = new Date();
reportTime(status, start, end);
status = "Date.UTC(1900, 5, 25) ";
start = new Date();
for(i=0; i<u_bound; i++)
{
Date.UTC(1900,5,25);
}
end = new Date();
reportTime(status, start, end);
status = "Date.UTC(1980, 5, 25) ";
start = new Date();
for(i=0; i<u_bound; i++)
{
Date.UTC(1980,5,25);
}
end = new Date();
reportTime(status, start, end);
status = "Date.UTC(2100, 5, 25) ";
start = new Date();
for(i=0; i<u_bound; i++)
{
Date.UTC(2100,5,25);
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,112 @@
/* ***** 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: 11 October 2002
* SUMMARY: Using the |UTC()| method for the |Date()| object.
* Converts a date to a string, using the universal time convention.
* UTC takes comma-delimited date parameters and returns the number of
* milliseconds between January 1, 1970, 00:00:00, universal time and
* the time you specified.
*
* Syntax: |Date.UTC(year, month, day[, hrs, min, sec, ms])|
* year - A year after 1900.
* month - An integer between 0 and 11 representing the month.
* date - An integer between 1 and 31 representing a day of the month.
* hrs - An integer between 0 and 23 representing the hours.
* min - An integer between 0 and 59 representing the minutes.
* sec - An integer between 0 and 59 representing the seconds.
* ms - An integer between 0 and 999 representing the milliseconds.
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
var year = 2002;
var month = 1;
var day = 1;
var hrs = 0;
var min = 0;
var sec = 0;
var ms = 0;
status = "Date.UTC(year, month, day[, hrs, min, sec, ms])";
start = new Date();
for(i=0; i<u_bound; i++)
{
Date.UTC(year, month, day, hrs, min, sec, ms);
}
end = new Date();
reportTime(status, start, end);
// Date before January 1, 1970
status = "Date.UTC(1900, 4, 25[, 11, 56, 12, 500])";
start = new Date();
for(i=0; i<u_bound; i++)
{
Date.UTC(1900, 4, 25, 11, 56, 12, 500);
}
end = new Date();
reportTime(status, start, end);
// Date before January 1, 1970
status = "Date.UTC(1900, 4, 25[, 11, 56, 12, 500])";
start = new Date();
for(i=0; i<u_bound; i++)
{
Date.UTC(1900, 4, 25, 11, 56, 12, 500);
}
end = new Date();
reportTime(status, start, end);
// Future date
status = "Date.UTC(2100, 4, 25[, 11, 56, 12, 500])";
start = new Date();
for(i=0; i<u_bound; i++)
{
Date.UTC(2100, 4, 25, 11, 56, 12, 500);
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,62 @@
/* ***** 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: 11 October 2002
* SUMMARY: Creation of empty date objects using local variables
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
var dt;
status = "new Date()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt = new Date();
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,132 @@
/* ***** 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: 11 October 2002
* SUMMARY: Creation of date objects using local variables. Testing miliseconds.
*
* Syntax: |Date()|
*
* Parameters:
* milliseconds - Integer value representing the number of milliseconds since
* 1 January 1970 00:00:00.
* dateString - String value representing a date. The string should be in a
* format recognized by the Date.parse method.
* yr_num, mo_num, day_num - Integer values representing part of a date. As an
* integer value, the month is represented by 0 to 11 with 0=January.
* hr_num, min_num, sec_num, ms_num - Integer values representing part of a
* date.
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
var dt;
var ms;
status = "new Date(ms) - ms = 10\t";
ms = 10;
start = new Date();
for(i=0; i<u_bound; i++)
{
dt = new Date(ms);
}
end = new Date();
reportTime(status, start, end);
status = "new Date(ms) - ms = 1000";
ms = 1000;
start = new Date();
for(i=0; i<u_bound; i++)
{
dt = new Date(ms);
}
end = new Date();
reportTime(status, start, end);
status = "new Date(ms) - ms = 1000000";
ms = 1000000;
start = new Date();
for(i=0; i<u_bound; i++)
{
dt = new Date(ms);
}
end = new Date();
reportTime(status, start, end);
status = "new Date(10)\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt = new Date(10);
}
end = new Date();
reportTime(status, start, end);
status = "new Date(1000)\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt = new Date(1000);
}
end = new Date();
reportTime(status, start, end);
status = "new Date(1000000)";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt = new Date(1000000);
}
end = new Date();
reportTime(status, start, end);
status = "new Date(10000000)";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt = new Date(10000000);
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,103 @@
/* ***** 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: 11 October 2002
* SUMMARY: Creation of date objects using local variables. Testing date strings.
*
* Syntax: |Date()|
*
* Parameters:
* dateString - String value representing a date. The string should be in a
* format recognized by the Date.parse method.
* yr_num, mo_num, day_num - Integer values representing part of a date. As an
* integer value, the month is represented by 0 to 11 with 0=January.
* hr_num, min_num, sec_num, ms_num - Integer values representing part of a
* date.
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
var dt;
// Invalid date
status = "new Date('')";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt = new Date('');
}
end = new Date();
reportTime(status, start, end);
// Date before January 1, 1970
status = "new Date('January 4, 1900')";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt = new Date('January 4, 1900');
}
end = new Date();
reportTime(status, start, end);
// Date after January 1, 1970
status = "new Date('May 25, 1980')";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt = new Date('May 25, 1980');
}
end = new Date();
reportTime(status, start, end);
// Future date
status = "new Date('May 25, 2100')";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt = new Date('May 25, 2100');
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,93 @@
/* ***** 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: 11 October 2002
* SUMMARY: Creation of date objects using local variables. Testing exact dates.
*
* Syntax: |Date()|
*
* Parameters:
* dateString - String value representing a date. The string should be in a
* format recognized by the Date.parse method.
* yr_num, mo_num, day_num - Integer values representing part of a date. As an
* integer value, the month is represented by 0 to 11 with 0=January.
* hr_num, min_num, sec_num, ms_num - Integer values representing part of a
* date.
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
var dt;
// Date before January 1, 1970
status = "new Date(1900, 4, 25, 11, 56, 25, 0)";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt = new Date(1900, 4, 25, 11, 56, 25, 0);
}
end = new Date();
reportTime(status, start, end);
// Date after January 1, 1970
status = "new Date(1980, 4, 25, 11, 56, 25, 0)";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt = new Date(1980, 4, 25, 11, 56, 25, 0);
}
end = new Date();
reportTime(status, start, end);
// Future date
status = "new Date(2100, 4, 25, 11, 56, 25, 0)";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt = new Date(2100, 4, 25, 11, 56, 25, 0);
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,154 @@
/* ***** 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: 11 October 2002
* SUMMARY: Testing various |get()| methods for the |Date()| object.
*/
//-----------------------------------------------------------------------------
var UBOUND=100000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
var dt;
dt = new Date();
status = "dt.getDate()\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getDate();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getDay()\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getDay();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getFullYear()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getFullYear();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getHours()\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getHours();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getMilliseconds()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getMilliseconds();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getMinutes()\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getMinutes();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getMonth()\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getMonth();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getSeconds()\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getSeconds();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getTime()\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getTime();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getTimezoneOffset()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getTimezoneOffset();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getYear()\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getYear();
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,155 @@
/* ***** 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: 11 October 2002
* SUMMARY: Testing various |get()| methods for the |Date()| object. Providing
* a specific date.
*/
//-----------------------------------------------------------------------------
var UBOUND=100000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
var dt;
dt = new Date(1980, 4, 25, 11, 56, 25, 0);
status = "dt.getDate()\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getDate();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getDay()\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getDay();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getFullYear()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getFullYear();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getHours()\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getHours();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getMilliseconds()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getMilliseconds();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getMinutes()\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getMinutes();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getMonth()\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getMonth();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getSeconds()\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getSeconds();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getTime()\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getTime();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getTimezoneOffset()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getTimezoneOffset();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getYear()\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getYear();
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,154 @@
/* ***** 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: 11 October 2002
* SUMMARY: Testing various |get()| methods for the |Date()| object.
*/
//-----------------------------------------------------------------------------
var UBOUND=100000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
var dt;
dt = new Date("May 25, 1980");
status = "dt.getDate()\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getDate();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getDay()\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getDay();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getFullYear()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getFullYear();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getHours()\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getHours();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getMilliseconds()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getMilliseconds();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getMinutes()\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getMinutes();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getMonth()\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getMonth();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getSeconds()\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getSeconds();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getTime()\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getTime();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getTimezoneOffset()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getTimezoneOffset();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getYear()\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getYear();
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,127 @@
/* ***** 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: 11 October 2002
* SUMMARY: Testing various |getUTC()| methods for the |Date()| object.
*/
//-----------------------------------------------------------------------------
var UBOUND=100000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
var dt;
dt = new Date();
status = "dt.getUTCDate()\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getUTCDate();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getUTCDay()\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getUTCDay();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getUTCFullYear()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getUTCFullYear();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getUTCHours()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getUTCHours();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getUTCMilliseconds()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getUTCMilliseconds();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getUTCMinutes()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getUTCMinutes();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getUTCMonth()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getUTCMonth();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getUTCSeconds()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getUTCSeconds();
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,127 @@
/* ***** 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: 11 October 2002
* SUMMARY: Testing various |getUTC()| methods for the |Date()| object.
*/
//-----------------------------------------------------------------------------
var UBOUND=100000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
var dt;
dt = new Date(1980, 4, 25, 11, 56, 25, 0);
status = "dt.getUTCDate()\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getUTCDate();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getUTCDay()\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getUTCDay();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getUTCFullYear()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getUTCFullYear();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getUTCHours()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getUTCHours();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getUTCMilliseconds()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getUTCMilliseconds();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getUTCMinutes()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getUTCMinutes();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getUTCMonth()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getUTCMonth();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getUTCSeconds()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getUTCSeconds();
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,128 @@
/* ***** 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: 11 October 2002
* SUMMARY: Testing various |getUTC()| methods for the |Date()| object. Using a
* string for the date.
*/
//-----------------------------------------------------------------------------
var UBOUND=100000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
var dt;
dt = new Date("May 25, 1980");
status = "dt.getUTCDate()\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getUTCDate();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getUTCDay()\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getUTCDay();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getUTCFullYear()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getUTCFullYear();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getUTCHours()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getUTCHours();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getUTCMilliseconds()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getUTCMilliseconds();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getUTCMinutes()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getUTCMinutes();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getUTCMonth()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getUTCMonth();
}
end = new Date();
reportTime(status, start, end);
status = "dt.getUTCSeconds()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.getUTCSeconds();
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,83 @@
/* ***** 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: 11 October 2002
* SUMMARY: Testing |parse()| method for the |Date()| object.
* Returns the number of milliseconds in a date string since
* January 1, 1970, 00:00:00, local time.
*
* Syntax: Date.parse(dateString)
*/
//-----------------------------------------------------------------------------
var UBOUND=100000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
status = "Date.parse('')\t\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
Date.parse('');
}
end = new Date();
reportTime(status, start, end);
status = "Date.parse('January 1, 1900')";
start = new Date();
for(i=0; i<u_bound; i++)
{
Date.parse('January 1, 1900');
}
end = new Date();
reportTime(status, start, end);
status = "Date.parse('May 25, 1980')";
start = new Date();
for(i=0; i<u_bound; i++)
{
Date.parse("May 25, 1980");
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,203 @@
/* ***** 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: 11 October 2002
* SUMMARY: Calling various |set()| methods for the |Date()| object.
*
* Syntax: |setDate(dayValue)|
* dayValue - An integer from 1 to 31, representing he day of the month.
*
* |setFullYear(yearValue[, monthValue, dayValue])|
* yearValue - An integer specifying the numeric value of the year.
* monthValue - An integer between 0 and 11 representing the months
* January through December.
* dayValue - An integer between 1 and 31 representing the day of the
* month. If you specify the dayValue parameter, you must also specify
* the monthValue.
*
* |setHours(hoursValue[, minutesValue, secondsValue, msValue]) |
* hoursValue - An integer between 0 and 23, representing the hour.
* minutesValue - An integer between 0 and 59, representing the minutes.
* secondsValue - An integer between 0 and 59, representing the seconds.
* If you specify the secondsValue parameter, you must also specify the
* minutesValue.
* msValue - A number between 0 and 999, representing the milliseconds.
* If you specify the msValue parameter, you must also specify the
* minutesValue and secondsValue.
*
* |setMilliseconds(msValue) |
* msValue - A number between 0 and 999, representing the
* milliseconds.
*
* |setMinutes(minutesValue[, secondsValue, msValue]) |
* minutesValue - An integer between 0 and 59,representing the minutes.
* secondsValue - An integer between 0 and 59,representing the seconds.
* If you specify the secondsValue parameter, you must also specify the
* minutesValue.
* msValue - A number between 0 and 999, representing the milliseconds.
* If you specify the msValue parameter, you must also specify the
* minutesValue and secondsValue.
*
* |setMonth(monthValue[, dayValue]) |
* monthValue - An integer between 0 and 11 (representing the months
* January through December).
* dayValue - An integer from 1 to 31, representing the day of the
* month.
*
* |setSeconds(secondsValue) |
* secondsValue - An integer between 0 and 59.
* msValue - A number between 0 and 999, representing the milliseconds.
*
* |setTime(timeValue) |
* timeValue - An integer representing the number of milliseconds
* since 1 January 1970 00:00:00.
*
* |setYear(yearValue) |
* yearValue - An integer.
*/
//-----------------------------------------------------------------------------
var UBOUND=10000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
var dt;
var dayValue = 1;
var monthValue = 1;
var yearValue = 2002;
var hoursValue = 0;
var minutesValue = 0;
var secondsValue = 0;
var msValue = 0;
var timeValue = 0;
dt = new Date();
status = "dt.setDate(dayValue)\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setDate(dayValue);
}
end = new Date();
reportTime(status, start, end);
status = "dt.setFullYear(yearValue)";
dt = new Date();
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setFullYear(yearValue);
}
end = new Date();
reportTime(status, start, end);
status = "dt.setHours(hoursValue)\t";
dt = new Date();
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setHours(hoursValue);
}
end = new Date();
reportTime(status, start, end);
status = "dt.setMilliseconds(msValue)";
dt = new Date();
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setMilliseconds(msValue);
}
end = new Date();
reportTime(status, start, end);
status = "dt.setMinutes(minutesValue)";
dt = new Date();
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setMinutes(minutesValue);
}
end = new Date();
reportTime(status, start, end);
status = "dt.setMonth(monthValue)\t";
dt = new Date();
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setMonth(monthValue);
}
end = new Date();
reportTime(status, start, end);
status = "dt.setSeconds(secondsValue)";
dt = new Date();
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setSeconds(secondsValue);
}
end = new Date();
reportTime(status, start, end);
status = "dt.setTime(timeValue)\t";
dt = new Date();
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setTime(timeValue);
}
end = new Date();
reportTime(status, start, end);
status = "dt.setYear(yearValue)\t";
dt = new Date();
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setYear(yearValue);
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,137 @@
/* ***** 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: 11 October 2002
* SUMMARY: Calling various |set()| methods for the |Date()| object using
* optional values.
*
* Syntax: |setFullYear(yearValue[, monthValue, dayValue])|
* yearValue - An integer specifying the numeric value of the year.
* monthValue - An integer between 0 and 11 representing the months
* January through December.
* dayValue - An integer between 1 and 31 representing the day of the
* month. If you specify the dayValue parameter, you must also specify
* the monthValue.
*
* |setHours(hoursValue[, minutesValue, secondsValue, msValue]) |
* hoursValue - An integer between 0 and 23, representing the hour.
* minutesValue - An integer between 0 and 59, representing minutes.
* secondsValue - An integer between 0 and 59, representing seconds.
* If you specify the secondsValue parameter, you must also specify the
* minutesValue.
* msValue - A number between 0 and 999, representing the milliseconds.
* If you specify the msValue parameter, you must also specify the
* minutesValue and secondsValue.
*
* |setMinutes(minutesValue[, secondsValue, msValue]) |
* minutesValue - An integer between 0 and 59, representing minutes.
* secondsValue - An integer between 0 and 59, representing seconds.
* If you specify the secondsValue parameter, you must also specify the
* minutesValue.
* msValue - A number between 0 and 999, representing milliseconds.
* If you specify the msValue parameter, you must also specify the
* minutesValue and secondsValue.
*
* |setMonth(monthValue[, dayValue]) |
* monthValue - An integer between 0 and 11 (representing the months
* January through December).
* dayValue - An integer from 1 to 31, representing the day of the
* month.
*
*/
//-----------------------------------------------------------------------------
var UBOUND=10000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
var dt;
var dayValue = 1;
var monthValue = 1;
var yearValue = 2002;
var hoursValue = 0;
var minutesValue = 0;
var secondsValue = 0;
var msValue = 0;
var timeValue = 0;
dt = new Date();
status = "dt.setFullYear(yearValue[, monthValue, dayValue])\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setFullYear(yearValue, monthValue, dayValue);
}
end = new Date();
reportTime(status, start, end);
status = "dt.setHours(hoursValue[, minutesValue, secondsValue, msValue])";
dt = new Date();
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setHours(hoursValue, minutesValue, secondsValue, msValue);
}
end = new Date();
reportTime(status, start, end);
status = "dt.setMinutes(minutesValue[, secondsValue, msValue])\t";
dt = new Date();
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setMinutes(minutesValue, secondsValue, msValue);
}
end = new Date();
reportTime(status, start, end);
status = "dt.setMonth(monthValue[, dayValue])\t\t\t";
dt = new Date();
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setMonth(monthValue, dayValue);
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,129 @@
/* ***** 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: 11 October 2002
* SUMMARY: Calling various |set()| methods for the |Date()| object using
* optional values.
*
* Syntax: |setFullYear(yearValue[, monthValue, dayValue])|
* yearValue - An integer specifying the numeric value of the year.
* monthValue - An integer between 0 and 11 representing the months
* January through December.
* dayValue - An integer between 1 and 31 representing the day of the
* month. If you specify the dayValue parameter, you must also specify
* the monthValue.
*
* |setHours(hoursValue[, minutesValue, secondsValue, msValue]) |
* hoursValue - An integer between 0 and 23, representing the hour.
* minutesValue - An integer between 0 and 59, representing minutes.
* secondsValue - An integer between 0 and 59, representing seconds.
* If you specify the secondsValue parameter, you must also specify the
* minutesValue.
* msValue - A number between 0 and 999, representing milliseconds.
* If you specify the msValue parameter, you must also specify the
* minutesValue and secondsValue.
*
* |setMinutes(minutesValue[, secondsValue, msValue]) |
* minutesValue - An integer between 0 and 59, representing minutes.
* secondsValue - An integer between 0 and 59, representing seconds.
* If you specify the secondsValue parameter, you must also specify the
* minutesValue.
* msValue - A number between 0 and 999, representing milliseconds.
* If you specify the msValue parameter, you must also specify the
* minutesValue and secondsValue.
*
* |setMonth(monthValue[, dayValue]) |
* monthValue - An integer between 0 and 11 (representing the months
* January through December).
* dayValue - An integer from 1 to 31, representing the day of the
* month.
*
*/
//-----------------------------------------------------------------------------
var UBOUND=10000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
var dt;
dt = new Date();
status = "dt.setFullYear(1980[, 4, 25])\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setFullYear(1980, 4, 25);
}
end = new Date();
reportTime(status, start, end);
status = "dt.setHours(10[, 35, 17, 2500])";
dt = new Date();
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setHours(10, 35, 17, 2500);
}
end = new Date();
reportTime(status, start, end);
status = "dt.setMinutes(35[, 17, 2500])\t";
dt = new Date();
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setMinutes(35, 17, 2500);
}
end = new Date();
reportTime(status, start, end);
status = "dt.setMonth(4[, 25])\t\t\t";
dt = new Date();
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setMonth(4, 25);
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,177 @@
/* ***** 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: 11 October 2002
* SUMMARY: Calling various |setUTC()| methods for the |Date()| object.
* Sets accoriding to universal time.
*
* Syntax: |setUTCDate(dayValue)|
* dayValue - An integer from 1 to 31, representing a day of the month.
*
* |setUTCFullYear(yearValue[, monthValue, dayValue])|
* yearValue - An integer specifying the numeric value of the year.
* monthValue - An integer between 0 and 11 representing the months
* January through December.
* dayValue - An integer between 1 and 31 representing the day of the
* month. If you specify the dayValue parameter, you must also specify
* the monthValue.
*
* |setUTCHours(hoursValue[, minutesValue, secondsValue, msValue]) |
* hoursValue - An integer between 0 and 23, representing the hour.
* minutesValue - An integer between 0 and 59, representing minutes.
* secondsValue - An integer between 0 and 59, representing seconds.
* If you specify the secondsValue parameter, you must also specify the
* minutesValue.
* msValue - A number between 0 and 999, representing milliseconds.
* If you specify the msValue parameter, you must also specify the
* minutesValue and secondsValue.
*
* |setUTCMilliseconds(msValue) |
* msValue - A number between 0 and 999, representing the
* milliseconds.
*
* |setUTCMinutes(minutesValue[, secondsValue, msValue]) |
* minutesValue - An integer between 0 and 59, representing minutes.
* secondsValue - An integer between 0 and 59, representing seconds.
* If you specify the secondsValue parameter, you must also specify the
* minutesValue.
* msValue - A number between 0 and 999, representing the milliseconds.
* If you specify the msValue parameter, you must also specify the
* minutesValue and secondsValue.
*
* |setUTCMonth(monthValue[, dayValue]) |
* monthValue - An integer between 0 and 11 (representing the months
* January through December).
* dayValue - An integer from 1 to 31, representing the day of the
* month.
*
* |setUTCSeconds(secondsValue) |
* secondsValue - An integer between 0 and 59.
* msValue - A number between 0 and 999, representing the milliseconds.
*/
//-----------------------------------------------------------------------------
var UBOUND=100000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
var dt;
var dayValue = 1;
var monthValue = 1;
var yearValue = 2002;
var hoursValue = 0;
var minutesValue = 0;
var secondsValue = 0;
var msValue = 0;
var timeValue = 0;
dt = new Date();
status = "dt.setUTCDate(dayValue)\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setUTCDate(dayValue);
}
end = new Date();
reportTime(status, start, end);
status = "dt.setUTCFullYear(yearValue)";
dt = new Date();
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setUTCFullYear(yearValue);
}
end = new Date();
reportTime(status, start, end);
status = "dt.setUTCHours(hoursValue)\t";
dt = new Date();
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setUTCHours(hoursValue);
}
end = new Date();
reportTime(status, start, end);
status = "dt.setUTCMilliseconds(msValue)";
dt = new Date();
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setUTCMilliseconds(msValue);
}
end = new Date();
reportTime(status, start, end);
status = "dt.setUTCMinutes(minutesValue)\t";
dt = new Date();
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setUTCMinutes(minutesValue);
}
end = new Date();
reportTime(status, start, end);
status = "dt.setUTCMonth(monthValue)\t";
dt = new Date();
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setUTCMonth(monthValue);
}
end = new Date();
reportTime(status, start, end);
status = "dt.setUTCSeconds(secondsValue)\t";
dt = new Date();
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setUTCSeconds(secondsValue);
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,136 @@
/* ***** 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: 11 October 2002
* SUMMARY: Calling various |setUTC()| methods for the |Date()| object.
Sets accoriding to universal time.
*
* Syntax:
* |setUTCFullYear(yearValue[, monthValue, dayValue])|
* yearValue - An integer specifying the numeric value of the year.
* monthValue - An integer between 0 and 11 representing months
* January through December.
* dayValue - An integer between 1 and 31 representing the day of the
* month. If you specify the dayValue parameter, you must also specify
* the monthValue.
*
* |setUTCHours(hoursValue[, minutesValue, secondsValue, msValue]) |
* hoursValue - An integer between 0 and 23, representing the hour.
* minutesValue - An integer between 0 and 59, representing minutes.
* secondsValue - An integer between 0 and 59, representing seconds.
* If you specify the secondsValue parameter, you must also specify the
* minutesValue.
* msValue - A number between 0 and 999, representing the milliseconds.
* If you specify the msValue parameter, you must also specify the
* minutesValue and secondsValue.
*
* |setUTCMinutes(minutesValue[, secondsValue, msValue]) |
* minutesValue - An integer between 0 and 59, representing minutes.
* secondsValue - An integer between 0 and 59, representing seconds.
* If you specify the secondsValue parameter, you must also specify the
* minutesValue.
* msValue - A number between 0 and 999, representing milliseconds.
* If you specify the msValue parameter, you must also specify the
* minutesValue and secondsValue.
*
* |setUTCMonth(monthValue[, dayValue]) |
* monthValue - An integer between 0 and 11 (representing the months
* January through December).
* dayValue - An integer from 1 to 31, representing the day of the
* month.
*/
//-----------------------------------------------------------------------------
var UBOUND=100000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
var dt;
var dayValue = 1;
var monthValue = 1;
var yearValue = 2002;
var hoursValue = 0;
var minutesValue = 0;
var secondsValue = 0;
var msValue = 0;
var timeValue = 0;
status = "dt.setUTCFullYear(yearValue[, monthValue, dayValue])";
dt = new Date();
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setUTCFullYear(yearValue, monthValue, dayValue);
}
end = new Date();
reportTime(status, start, end);
status = "dt.setUTCHourshoursValue[, minutesValue, secondsValue, msValue])";
dt = new Date();
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setUTCHours(hoursValue, minutesValue, secondsValue, msValue);
}
end = new Date();
reportTime(status, start, end);
status = "dt.setUTCMinutes(minutesValue[, secondsValue, msValue])";
dt = new Date();
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setUTCMinutes(minutesValue, secondsValue, msValue);
}
end = new Date();
reportTime(status, start, end);
status = "dt.setUTCMonth(monthValue[, dayValue])";
dt = new Date();
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setUTCMonth(monthValue, dayValue);
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,129 @@
/* ***** 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: 11 October 2002
* SUMMARY: Calling various |setUTC()| methods for the |Date()| object using
* optional values.
*
* Syntax: |setUTCFullYear(yearValue[, monthValue, dayValue])|
* yearValue - An integer specifying the numeric value of the year.
* monthValue - An integer between 0 and 11 representing the months
* January through December.
* dayValue - An integer between 1 and 31 representing the day of the
* month. If you specify the dayValue parameter, you must also specify
* the monthValue.
*
* |setUTCHours(hoursValue[, minutesValue, secondsValue, msValue]) |
* hoursValue - An integer between 0 and 23, representing the hour.
* minutesValue - An integer between 0 and 59, representing the minutes.
* secondsValue - An integer between 0 and 59, representing the seconds.
* If you specify the secondsValue parameter, you must also specify the
* minutesValue.
* msValue - A number between 0 and 999, representing the milliseconds.
* If you specify the msValue parameter, you must also specify the
* minutesValue and secondsValue.
*
* |setUTCMinutes(minutesValue[, secondsValue, msValue]) |
* minutesValue - An integer between 0 and 59, representing the minutes.
* secondsValue - An integer between 0 and 59, representing the seconds.
* If you specify the secondsValue parameter, you must also specify the
* minutesValue.
* msValue - A number between 0 and 999, representing the milliseconds.
* If you specify the msValue parameter, you must also specify the
* minutesValue and secondsValue.
*
* |setUTCMonth(monthValue[, dayValue]) |
* monthValue - An integer between 0 and 11 (representing the months
* January through December).
* dayValue - An integer from 1 to 31, representing the day of the
* month.
*
*/
//-----------------------------------------------------------------------------
var UBOUND=10000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
var dt;
dt = new Date();
status = "dt.setUTCFullYear(1980[, 4, 25])";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setUTCFullYear(1980, 4, 25);
}
end = new Date();
reportTime(status, start, end);
status = "dt.setUTCHours(10[, 35, 17, 2500])";
dt = new Date();
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setUTCHours(10, 35, 17, 2500);
}
end = new Date();
reportTime(status, start, end);
status = "dt.setUTCMinutes(35[, 17, 2500])";
dt = new Date();
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setUTCMinutes(35, 17, 2500);
}
end = new Date();
reportTime(status, start, end);
status = "dt.setUTCMonth(4[, 25])";
dt = new Date();
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.setUTCMonth(4, 25);
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,111 @@
/* ***** 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: 11 October 2002
* SUMMARY: Using the |toGMTString()| method for the |Date()| object.
* Converts a date to a string, using the Internet GMT conventions.
*
* Syntax: toGMTString()
*/
//-----------------------------------------------------------------------------
var UBOUND=100000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
var dt;
// Current date
dt = new Date();
status = "dt.toGMTString()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.toGMTString();
}
end = new Date();
reportTime(status, start, end);
// Invalid date
dt = new Date('');
status = "dt.toGMTString()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.toGMTString();
}
end = new Date();
reportTime(status, start, end);
// Date before January 1, 1970
dt = new Date('January 4, 1900');
status = "dt.toGMTString()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.toGMTString();
}
end = new Date();
reportTime(status, start, end);
// Date after January 1, 1970
dt = new Date('May 25, 1980');
status = "dt.toGMTString()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.toGMTString();
}
end = new Date();
reportTime(status, start, end);
// Future date
dt = new Date('May 25, 2100');
status = "dt.toGMTString()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.toGMTString();
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,111 @@
/* ***** 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: 11 October 2002
* SUMMARY: Using the |toLocaleString()| method for the |Date()| object.
* Converts a date to a string, using current locale's conventions.
*
* Syntax: toLocaleString()
*/
//-----------------------------------------------------------------------------
var UBOUND=100000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
var dt;
// Current Date
dt = new Date();
status = "dt.toLocaleString()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.toLocaleString();
}
end = new Date();
reportTime(status, start, end);
// Invalid date
dt = new Date('');
status = "dt.toLocaleString()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.toLocaleString();
}
end = new Date();
reportTime(status, start, end);
// Date before January 1, 1970
dt = new Date('January 4, 1900');
status = "dt.toLocaleString()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.toLocaleString();
}
end = new Date();
reportTime(status, start, end);
// Date after January 1, 1970
dt = new Date('May 25, 1980');
status = "dt.toLocaleString()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.toLocaleString();
}
end = new Date();
reportTime(status, start, end);
// Future date
dt = new Date('May 25, 2100');
status = "dt.toLocaleString()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.toLocaleString();
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,111 @@
/* ***** 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: 11 October 2002
* SUMMARY: Using the |toSource()| method for the |Date()| object.
* Returns a string representing the source code of the object.
*
* Syntax: toSource()
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
var dt;
// Current Date
dt = new Date();
status = "dt.toSource()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.toSource();
}
end = new Date();
reportTime(status, start, end);
// Invalid date
dt = new Date('');
status = "dt.toSource()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.toSource();
}
end = new Date();
reportTime(status, start, end);
// Date before January 1, 1970
dt = new Date('January 4, 1900');
status = "dt.toSource()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.toSource();
}
end = new Date();
reportTime(status, start, end);
// Date after January 1, 1970
dt = new Date('May 25, 1980');
status = "dt.toSource()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.toSource();
}
end = new Date();
reportTime(status, start, end);
// Future date
dt = new Date('May 25, 2100');
status = "dt.toSource()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.toSource();
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,111 @@
/* ***** 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: 11 October 2002
* SUMMARY: Using ths |toString()| method for the |Date()| object.
* Returns a string representing the specified Date object.
*
* Syntax: toString()
*/
//-----------------------------------------------------------------------------
var UBOUND=10000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
var dt;
// Current Date
dt = new Date();
status = "dt.toString()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.toString();
}
end = new Date();
reportTime(status, start, end);
// Invalid date
dt = new Date('');
status = "dt.toString()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.toString();
}
end = new Date();
reportTime(status, start, end);
// Date before January 1, 1970
dt = new Date('January 4, 1900');
status = "dt.toString()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.toString();
}
end = new Date();
reportTime(status, start, end);
// Date after January 1, 1970
dt = new Date('May 25, 1980');
status = "dt.toString()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.toString();
}
end = new Date();
reportTime(status, start, end);
// Future date
dt = new Date('May 25, 2100');
status = "dt.toString()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.toString();
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,111 @@
/* ***** 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: 11 October 2002
* SUMMARY: Using the |toUTCString()| method for the |Date()| object.
* Converts a date to a string, using the universal time convention.
*
* Syntax: toUTCString()
*/
//-----------------------------------------------------------------------------
var UBOUND=100000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
var dt;
// Current date
dt = new Date();
status = "dt.toUTCString()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.toUTCString();
}
end = new Date();
reportTime(status, start, end);
// Invalid date
dt = new Date('');
status = "dt.toUTCString()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.toUTCString();
}
end = new Date();
reportTime(status, start, end);
// Date before January 1, 1970
dt = new Date('January 4, 1900');
status = "dt.toUTCString()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.toUTCString();
}
end = new Date();
reportTime(status, start, end);
// Date after January 1, 1970
dt = new Date('May 25, 1980');
status = "dt.toUTCString()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.toUTCString();
}
end = new Date();
reportTime(status, start, end);
// Future date
dt = new Date('May 25, 2100');
status = "dt.toUTCString()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.toUTCString();
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,67 @@
/* ***** 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: 11 October 2002
* SUMMARY: Calling the |valueOf()| method for the |Date()| object.
* Returns the primitive value of a Date object.
*
* Syntax: |valueOf()|
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
var dt;
dt = new Date();
status = "dt.valueOf()";
start = new Date();
for(i=0; i<u_bound; i++)
{
dt.valueOf();
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,71 @@
/* ***** 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: 02 October 2002
* SUMMARY: Creation of empty functions using local variables
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound=UBOUND;
var status;
var start;
var end;
var func;
var d;
status = 'new Function()';
start = new Date();
for(var i=0;i<u_bound; i++)
{
func=new Function();
}
end = new Date();
reportTime(status, start, end);
status = 'd=function(){}';
start = new Date();
for(var i=0;i<u_bound; i++)
{
d=function(){};
}
end = new Date();
reportTime(status, start,end);
}

Просмотреть файл

@ -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: 12 October 2002
* SUMMARY: Testing the |abs()| method for the Math object. It returns the
* absolute value of a number.
*
* Syntax: |abs(x)| where x is an integer.
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
status = "Math.abs(0)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.abs(0);
}
end = new Date();
reportTime(status, start, end);
status = "Math.abs(1)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.abs(1);
}
end = new Date();
reportTime(status, start, end);
status = "Math.abs(-1)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.abs(-1);
}
end = new Date();
reportTime(status, start, end);
status = "Math.abs(180)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.abs(180);
}
end = new Date();
reportTime(status, start, end);
status = "Math.abs(-180)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.abs(-180);
}
end = new Date();
reportTime(status, start, end);
status = "Math.abs(1000000)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.abs(1000000);
}
end = new Date();
reportTime(status, start, end);
status = "Math.abs(-1000000)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.abs(-1000000);
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,141 @@
/* ***** 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: 12 October 2002
* SUMMARY: Testing the |acos()| method for the Math object. The acos method
* returns a numeric value between 0 and pi radians. If the value of number is
* outside this range, it returns NaN. Because acos is a static method of Math,
* you always use it as Math.acos(), rather than as a method of a Math object
* you created.
*
* Syntax: |acos(x)| where x is a number.
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
status = "Math.acos(0)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.acos(0);
}
end = new Date();
reportTime(status, start, end);
status = "Math.acos(1)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.acos(1);
}
end = new Date();
reportTime(status, start, end);
status = "Math.acos(-1)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.acos(-1);
}
end = new Date();
reportTime(status, start, end);
status = "Math.acos(.25)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.acos(.25);
}
end = new Date();
reportTime(status, start, end);
status = "Math.acos(.87)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.acos(.87);
}
end = new Date();
reportTime(status, start, end);
// Invalid, value returns a NaN
status = "Math.acos(5)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.acos(5);
}
end = new Date();
reportTime(status, start, end);
status = "Math.acos(-.25)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.acos(-.25);
}
end = new Date();
reportTime(status, start, end);
status = "Math.acos(-.87)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.acos(-.87);
}
end = new Date();
reportTime(status, start, end);
// Invalid, value returns a NaN
status = "Math.acos(-5)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.acos(-5);
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,140 @@
/* ***** 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: 12 October 2002
* SUMMARY: Testing the |asin()| method for the Math object. The asin method
* returns a numeric value between -pi/2 and pi/2 radians. If the value of
* number is outside this range, it returns NaN. Because asin is a static
* method of Math, you always use it as Math.asin(), rather than as a method
* of a Math object you created.
*
* Syntax: |asin(x)| where x is a number.
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
status = "Math.asin(0)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.asin(0);
}
end = new Date();
reportTime(status, start, end);
status = "Math.asin(1)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.asin(1);
}
end = new Date();
reportTime(status, start, end);
status = "Math.asin(-1)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.asin(-1);
}
end = new Date();
reportTime(status, start, end);
status = "Math.asin(.25)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.asin(.25);
}
end = new Date();
reportTime(status, start, end);
status = "Math.asin(.87)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.asin(.87);
}
end = new Date();
reportTime(status, start, end);
status = "Math.asin(5)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.asin(5);
}
end = new Date();
reportTime(status, start, end);
//value returns a NaN
status = "Math.asin(-.25)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.asin(-.25);
}
end = new Date();
reportTime(status, start, end);
status = "Math.asin(-.87)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.asin(-.87);
}
end = new Date();
reportTime(status, start, end);
status = "Math.asin(-5)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.asin(-5);
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,138 @@
/* ***** 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: 12 October 2002
* SUMMARY: Testing the |atan()| method for the Math object. The method returns
* a numeric value between -pi/2 and pi/2 radians. Because atan is a static
* method of Math, you always use it as Math.atan(), rather than as a method of
* a Math object you created.
*
* Syntax: |atan(x)| where x is a number.
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
status = "Math.atan(0)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.atan(0);
}
end = new Date();
reportTime(status, start, end);
status = "Math.atan(1)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.atan(1);
}
end = new Date();
reportTime(status, start, end);
status = "Math.atan(-1)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.atan(-1);
}
end = new Date();
reportTime(status, start, end);
status = "Math.atan(90)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.atan(90);
}
end = new Date();
reportTime(status, start, end);
status = "Math.atan(120)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.atan(120);
}
end = new Date();
reportTime(status, start, end);
status = "Math.atan(180)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.atan(180);
}
end = new Date();
reportTime(status, start, end);
status = "Math.atan(-90)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.atan(-90);
}
end = new Date();
reportTime(status, start, end);
status = "Math.atan(-120)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.atan(-120);
}
end = new Date();
reportTime(status, start, end);
status = "Math.atan(-180)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.atan(-180);
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,125 @@
/* ***** 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: 12 October 2002
* SUMMARY: Testing the |atan2()| method for the Math object. The method
* returns a numeric value between -pi and pi representing the angle theta of
* an (x,y) point. This is the counterclockwise angle, measured in radians,
* between the positive X axis, and the point (x,y). Note that the arguments
* to this function pass the y-coordinate first and the x-coordinate second.
* |atan2()| is passed separate x and y arguments, and |atan2()| is passed the
* ratio of those two arguments. Because |atan2()| is a static method of Math,
* you always use it as |Math.atan2()|, rather than as a method of a Math
* object you created.
*
* Syntax: |atan2(x)| where x is a number.
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
status = "Math.atan2(0,0)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.atan2(0,0);
}
end = new Date();
reportTime(status, start, end);
status = "Math.atan2(0,180)"
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.atan2(0,180);
}
end = new Date();
reportTime(status, start, end);
status = "Math.atan2(120,0)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.atan2(120,0);
}
end = new Date();
reportTime(status, start, end);
status = "Math.atan2(90,90)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.atan2(90,90);
}
end = new Date();
reportTime(status, start, end);
status = "Math.atan2(-120,0)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.atan2(-120,0);
}
end = new Date();
reportTime(status, start, end);
status = "Math.atan2(0,-180)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.atan2(0,-180);
}
end = new Date();
reportTime(status, start, end);
status = "Math.atan2(-120,-120)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.atan2(-120,-120);
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -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: 12 October 2002
* SUMMARY: Testing the |ceil()| method for the Math object. Returns the
* smallest integer greater than or equal to a number.
*
* Syntax: |ceil(x)| where x is a number.
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
status = "Math.ceil()";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.ceil();
}
end = new Date();
reportTime(status, start, end);
status = "Math.ceil(0)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.ceil(0);
}
end = new Date();
reportTime(status, start, end);
status = "Math.ceil(1)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.ceil(1);
}
end = new Date();
reportTime(status, start, end);
status = "Math.ceil(25.25)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.ceil(25.25);
}
end = new Date();
reportTime(status, start, end);
status = "Math.ceil(-25.25)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.ceil(-25.25);
}
end = new Date();
reportTime(status, start, end);
status = "Math.ceil(7500000.750000000)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.ceil(7500000.750000000);
}
end = new Date();
reportTime(status, start, end);
status = "Math.ceil(-7500000.750000000)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.ceil(-7500000.750000000);
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,136 @@
/* ***** 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: 12 October 2002
* SUMMARY: Testing the |cos()| method for the Math object. It returns the
* cosine of a number.
*
* Syntax: |cos(x)| where x is a number.
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
status = "Math.cos(0)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.cos(0);
}
end = new Date();
reportTime(status, start, end);
status = "Math.cos(1)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.cos(1);
}
end = new Date();
reportTime(status, start, end);
status = "Math.cos(-1)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.cos(-1);
}
end = new Date();
reportTime(status, start, end);
status = "Math.cos(90)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.cos(90);
}
end = new Date();
reportTime(status, start, end);
status = "Math.cos(120)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.cos(120);
}
end = new Date();
reportTime(status, start, end);
status = "Math.cos(180)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.cos(180);
}
end = new Date();
reportTime(status, start, end);
status = "Math.cos(-90)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.cos(-90);
}
end = new Date();
reportTime(status, start, end);
status = "Math.cos(-120)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.cos(-120);
}
end = new Date();
reportTime(status, start, end);
status = "Math.cos(-180)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.cos(-180);
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,117 @@
/* ***** 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: 12 October 2002
* SUMMARY: Testing the |LN2| method for the Math object. The natural
* logarithm of 2, approximately 0.693.
* Testing the |LN10| method for the Math object. The natural
* logarithm of 10, approximately 2.302.
* Testing the |LOG2E| method for the Math object. The base 2
* logarithm of E (approximately 1.442).
* Testing the |LOG10E| method for the Math object. The base 10
* logarithm of E (approximately 0.434).
* Testing the |PI| method for the Math object. The ratio of the
* circumference of a circle to its diameter, approximately 3.14159.
* Testing the |SQRT2| method for the Math object. The square root of
* 2, approximately 1.414.
*/
//-----------------------------------------------------------------------------
var UBOUND=10000000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
status = "Math.LN2";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.LN2;
}
end = new Date();
reportTime(status, start, end);
status = "Math.LN10";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.LN10;
}
end = new Date();
reportTime(status, start, end);
status = "Math.LOG2E";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.LOG2E;
}
end = new Date();
reportTime(status, start, end);
status = "Math.LOG10E";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.LOG10E;
}
end = new Date();
reportTime(status, start, end);
status = "Math.PI\t";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.PI
}
end = new Date();
reportTime(status, start, end);
status = "Math.SQRT2";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.SQRT2;
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,119 @@
/* ***** 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: 12 October 2002
* SUMMARY: Testing the |exp()| method for the Math object. It returns E^x,
* where x is the argument, and E is Euler's constant, the base of the
* natural logarithms.
*
* Syntax: |exp(x)| where x is a number.
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
status = "Math.exp(0)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.exp(0);
}
end = new Date();
reportTime(status, start, end);
status = "Math.exp(1)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.exp(1);
}
end = new Date();
reportTime(status, start, end);
status = "Math.exp(-1)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.exp(-1);
}
end = new Date();
reportTime(status, start, end);
status = "Math.exp(100)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.exp(100);
}
end = new Date();
reportTime(status, start, end);
status = "Math.exp(1000)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.exp(1000);
}
end = new Date();
reportTime(status, start, end);
status = "Math.exp(-100)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.exp(-100);
}
end = new Date();
reportTime(status, start, end);
status = "Math.exp(-1000)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.exp(-1000);
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -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: 12 October 2002
* SUMMARY: Testing the |floor()| method for the Math object. Returns the
* largest integer less than or equal to a number.
*
* Syntax: |floor(x)| where x is a number.
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
status = "Math.floor()";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.floor();
}
end = new Date();
reportTime(status, start, end);
status = "Math.floor(0)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.floor(0);
}
end = new Date();
reportTime(status, start, end);
status = "Math.floor(1)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.floor(1);
}
end = new Date();
reportTime(status, start, end);
status = "Math.floor(25.25)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.floor(25.25);
}
end = new Date();
reportTime(status, start, end);
status = "Math.floor(-25.25)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.floor(-25.25);
}
end = new Date();
reportTime(status, start, end);
status = "Math.floor(7500000.750000000)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.floor(7500000.750000000);
}
end = new Date();
reportTime(status, start, end);
status = "Math.floor(-7500000.750000000)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.floor(-7500000.750000000);
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,136 @@
/* ***** 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: 12 October 2002
* SUMMARY: Testing the |log()| method for the Math object. It rturns the
* natural logarithm (base E) of a number.
*
* Syntax: |log(x)| where x is a number.
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
status = "Math.log(0)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.log(0);
}
end = new Date();
reportTime(status, start, end);
status = "Math.log(1)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.log(1);
}
end = new Date();
reportTime(status, start, end);
status = "Math.log(-1)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.log(-1);
}
end = new Date();
reportTime(status, start, end);
status = "Math.log(100)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.log(100);
}
end = new Date();
reportTime(status, start, end);
status = "Math.log(1000)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.log(1000);
}
end = new Date();
reportTime(status, start, end);
status = "Math.log(1000000)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.log(1000000);
}
end = new Date();
reportTime(status, start, end);
status = "Math.log(-100)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.log(-100);
}
end = new Date();
reportTime(status, start, end);
status = "Math.log(-10000)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.log(-10000);
}
end = new Date();
reportTime(status, start, end);
status = "Math.log(-1000000)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.log(-1000000);
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,136 @@
/* ***** 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: 12 October 2002
* SUMMARY: Testing the |max()| method for the Math object. It returns the
* larger of the two numbers.
*
* Syntax: |max(x)| where x is a number.
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
status = "Math.max(0,0)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.max(0,0);
}
end = new Date();
reportTime(status, start, end);
status = "Math.max(-1,1)"
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.max(0,180);
}
end = new Date();
reportTime(status, start, end);
status = "Math.max(150,-225)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.max(150,-225);
}
end = new Date();
reportTime(status, start, end);
status = "Math.max(2500,0)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.max(2500,0);
}
end = new Date();
reportTime(status, start, end);
status = "Math.max(0,-5200)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.max(0,-5200);
}
end = new Date();
reportTime(status, start, end);
status = "Math.max(-25,-25)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.max(-25-25);
}
end = new Date();
reportTime(status, start, end);
status = "Math.max(100000,-100000)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.max(100000,-100000);
}
end = new Date();
reportTime(status, start, end);
status = "Math.max(100000,5)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.max(100000,5);
}
end = new Date();
reportTime(status, start, end);
status = "Math.max(5,-100000)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.max(5,-100000);
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,135 @@
/* ***** 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: 12 October 2002
* SUMMARY: Testing the |min()| method for the Math object. It returns the
* lesser of the two numbers.
*
* Syntax: |min(x)| where x is a number.
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
status = "Math.min(0,0)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.min(0,0);
}
end = new Date();
reportTime(status, start, end);
status = "Math.min(-1,1)"
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.min(0,180);
}
end = new Date();
reportTime(status, start, end);
status = "Math.min(150,-225)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.min(150,-225);
}
end = new Date();
reportTime(status, start, end);
status = "Math.min(2500,0)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.min(2500,0);
}
end = new Date();
reportTime(status, start, end);
status = "Math.min(0,-5200)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.min(0,-5200);
}
end = new Date();
reportTime(status, start, end);
status = "Math.min(-25,-25)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.min(-25-25);
}
end = new Date();
reportTime(status, start, end);
status = "Math.min(100000,-100000)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.min(100000,-100000);
}
end = new Date();
reportTime(status, start, end);
status = "Math.min(100000,5)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.min(100000,5);
}
end = new Date();
reportTime(status, start, end);
status = "Math.min(5,-100000)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.min(5,-100000);
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,137 @@
/* ***** 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: 12 October 2002
* SUMMARY: Testing the |pow(x,y)| method for the Math object. It returns base
* to the exponent power.
*
* Syntax: |min(x,y)| where x is the base and y is the exponent to which
* to raise base
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
status = "Math.pow(0,0)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.pow(0,0);
}
end = new Date();
reportTime(status, start, end);
status = "Math.pow(0,1)"
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.pow(0,1);
}
end = new Date();
reportTime(status, start, end);
status = "Math.pow(1,1)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.pow(1,1);
}
end = new Date();
reportTime(status, start, end);
status = "Math.pow(1,-1)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.pow(1,-1);
}
end = new Date();
reportTime(status, start, end);
status = "Math.pow(2,10)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.pow(2,10);
}
end = new Date();
reportTime(status, start, end);
status = "Math.pow(2,100)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.pow(2,100);
}
end = new Date();
reportTime(status, start, end);
status = "Math.pow(2,1000000)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.pow(2,1000000);
}
end = new Date();
reportTime(status, start, end);
status = "Math.pow(2,-100000)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.pow(2,-100000);
}
end = new Date();
reportTime(status, start, end);
status = "Math.pow(2,1000000)";
start = new Date();
for(i=0; i<u_bound; i++)
{
Math.pow(2,10000000);
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,72 @@
/* ***** 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: 02 October 2002
* SUMMARY: Creation of empty number objects using local variables.
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound=UBOUND;
var status;
var start;
var end;
var num;
var e;
var i;
status = 'new Number()';
start = new Date();
for(i=0;i<u_bound; i++)
{
num=new Number();
}
end = new Date();
reportTime(status, start, end);
status = 'e=1\t';
start = new Date();
for(i=0;i<u_bound; i++)
{
e=1;
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,72 @@
/* ***** 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: 02 October 2002
* SUMMARY: Creation of empty objects using local variables
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound=UBOUND;
var status;
var start;
var end;
var i;
var a;
var b;
status = 'new Object()';
var start = new Date();
for(i=0;i<u_bound; i++)
{
a = new Object();
}
end = new Date();
reportTime(status, start, end);
status = 'var b = {}';
start = new Date();
for(var i=0;i<u_bound; i++)
{
b = {};
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,108 @@
/* ***** 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: 12 October 2002
* SUMMARY: Testing the |toSource()| method for an object created. It returns a
* string representing the source code of the object.
*
* Syntax: |toSource()|
*/
//-----------------------------------------------------------------------------
var UBOUND=100000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
var obj;
var string;
var a, b;
var str1, str2;
status = "obj.toSource()\t";
obj = new Object;
start = new Date();
for(i=0; i<u_bound; i++)
{
obj.toSource();
}
end = new Date();
reportTime(status, start, end);
/* The following code defines a "Princesses" object and creates
* "thePrincesses" as a type "Princesses."
*/
function Princesses2(girl1, girl2)
{
this.girl1=girl1;
this.girl2=girl2;
}
thePrincesses2 = new Princesses2("Cinderella","Jasmine");
status = "Object.toSource() - 2 properties";
start = new Date();
for(i=0; i<u_bound; i++)
{
thePrincesses2.toSource();
}
end = new Date();
reportTime(status, start, end);
function Princesses4(girl1, girl2, girl3, girl4)
{
this.girl1=girl1;
this.girl2=girl2;
this.girl3=girl3;
this.girl4=girl4;
}
thePrincesses4 = new Princesses4("Cinderella","Belle","Ariel","Jasmine");
status = "Object.toSource() - 4 properties";
start = new Date();
for(i=0; i<u_bound; i++)
{
thePrincesses4.toSource();
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,89 @@
/* ***** 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: 12 October 2002
* SUMMARY: Testing the |toString()| method for an object created. Returns a
* string representing the specified object.
*
* Syntax: |toString()|
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound = UBOUND;
var status;
var start;
var end;
var i;
var obj=new Object; //change back and remove obj
var string;
var a, b;
var str1, str2;
status = "obj.toString()\t";
obj = new Object;
start = new Date();
for(i=0; i<u_bound; i++)
{
obj.toString();
}
end = new Date();
reportTime(status, start, end);
/* The following code defines a "Princesses" object and creates
* "thePrincesses" as a type "Princesses."
*/
function Princesses(girl1, girl2)
{
this.girl1=girl1;
this.girl2=girl2;
}
thePrincesses = new Princesses("Cinderella","Jasmine");
status = "Object.toString() - 2 properties";
start = new Date();
for(i=0; i<u_bound; i++)
{
thePrincesses.toString();
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,75 @@
/* ***** 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: 02 October 2002
* SUMMARY: Creation of empty regexp objects using local variables.
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound=UBOUND;
var status = 'new RegExp()';
var start;
var end;
var re;
var reg;
var i;
start = new Date();
for(i=0; i<u_bound; i++)
{
re = new RegExp("");
}
end = new Date();
reportTime(status, start, end);
/*
* RegExp literals must contain an expression, otherwise
* they will be interpreted as the comment sign |//|.
*/
status = 'reg=/\w/';
start = new Date();
for(i=0; i<u_bound; i++)
{
reg=/\w/;
}
end = new Date();
reportTime(status, start, end);
}

Просмотреть файл

@ -0,0 +1,72 @@
/* ***** 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: 02 October 2002
* SUMMARY: Creation of empty string objects using local variables
*/
//-----------------------------------------------------------------------------
var UBOUND=1000000;
test();
function test()
{
var u_bound=UBOUND;
var status;
var i;
var str;
var end;
var start;
var c;
status = 'new String()';
start = new Date();
for(i=0;i<u_bound; i++)
{
str = new String();
}
end = new Date();
reportTime(status, start, end);
status ='c = ""\t';
start = new Date();
for(var i=0;i<u_bound; i++)
{
c = "";
}
end = new Date();
reportTime(status, start, end);
}