/*============================================================================= * Copyright Texas Instruments 2003. All Rights Reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ var ctm = java.lang.System.currentTimeMillis; var t; var max = 1000000; var itr = 3; for( var i=0; iResults for ObjectScript: bench.os"); writeln(" TestTime (ms)"); var total = 0; // simple loop: { t = ctm(); var cnt = 0; for( var j=0; jsimple loop: " + t + ""); } // simple fxn call: { var cnt = 0; function count() { cnt++; } t = ctm(); for( var j=0; jsimple fxn: " + t + ""); } // function call with argument: { var cnt = 0; function count(a) { cnt += a; } t = ctm(); for( var j=0; jsimple fxn with arg: " + t + ""); } // function call with three arguments: { var cnt = 0; function count(a,b,c) { cnt += a; } t = ctm(); for( var j=0; jsimple fxn with three args: " + t + ""); } // function call with local: { var cnt = 0; function count() { var a = 1; cnt += a; } t = ctm(); for( var j=0; jsimple fxn with local: " + t + ""); } // member dereference: { var obj = new (function() { public var cnt = 0; })(); t = ctm(); for( var j=0; jmember dereference: " + t + ""); } // string concationation test: { var str = ""; t = ctm(); for( var j=0; j<3000; j++ ) str += "0123456789"; t = ctm() - t; total += t; writeln(" string concat: " + t + ""); } // java class access: { var foo; t = ctm(); for( var j=0; jjava class access: " + t + ""); } writeln(" total: " + total + ""); }