dual-fields-micro.js revision 6:5a1b0714df0e
139213Sgibbs/* 239213Sgibbs * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 339213Sgibbs * 442648Sgibbs * Redistribution and use in source and binary forms, with or without 539213Sgibbs * modification, are permitted provided that the following conditions 639213Sgibbs * are met: 739213Sgibbs * 839213Sgibbs * - Redistributions of source code must retain the above copyright 939213Sgibbs * notice, this list of conditions and the following disclaimer. 1039213Sgibbs * 1139213Sgibbs * - Redistributions in binary form must reproduce the above copyright 1239213Sgibbs * notice, this list of conditions and the following disclaimer in the 1339213Sgibbs * documentation and/or other materials provided with the distribution. 1439213Sgibbs * 1539213Sgibbs * - Neither the name of Oracle nor the names of its 1639213Sgibbs * contributors may be used to endorse or promote products derived 1739213Sgibbs * from this software without specific prior written permission. 1839213Sgibbs * 1939213Sgibbs * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 2039213Sgibbs * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 2139213Sgibbs * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2239213Sgibbs * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 2339213Sgibbs * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 2439213Sgibbs * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 2539213Sgibbs * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 2639213Sgibbs * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 2739213Sgibbs * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 2849929Sgibbs * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 2939213Sgibbs * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3039213Sgibbs */ 3139213Sgibbs 3239213Sgibbsfunction b(x,y) { 3339213Sgibbs return x * y; //this one always returns a double 3439213Sgibbs} 3539213Sgibbs 3639213Sgibbsvar sum = 1; 3739213Sgibbsfunction bench() { 3839213Sgibbs var d = new Date; 3939213Sgibbs 4039213Sgibbs for (var iter = 0; iter <4*50e6; iter++) { 4139213Sgibbs sum *= 20 * b(21,22); 4239213Sgibbs } 4339213Sgibbs 4439213Sgibbs print("time = " +(new Date-d)); 4539213Sgibbs print(sum); 4639213Sgibbs} 4739213Sgibbs 4839213Sgibbsbench(); 4941815Sgibbs