jaroslav@381: /** jaroslav@381: * Back 2 Browser Bytecode Translator jaroslav@381: * Copyright (C) 2012 Jaroslav Tulach jaroslav@381: * jaroslav@381: * This program is free software: you can redistribute it and/or modify jaroslav@381: * it under the terms of the GNU General Public License as published by jaroslav@381: * the Free Software Foundation, version 2 of the License. jaroslav@381: * jaroslav@381: * This program is distributed in the hope that it will be useful, jaroslav@381: * but WITHOUT ANY WARRANTY; without even the implied warranty of jaroslav@381: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the jaroslav@381: * GNU General Public License for more details. jaroslav@381: * jaroslav@381: * You should have received a copy of the GNU General Public License jaroslav@381: * along with this program. Look for COPYING file in the top folder. jaroslav@381: * If not, see http://opensource.org/licenses/GPL-2.0. jaroslav@381: */ jaroslav@381: package org.apidesign.benchmark.matrixmul; jaroslav@381: jaroslav@381: import java.io.IOException; jaroslav@381: import org.apidesign.bck2brwsr.vmtest.Compare; jaroslav@381: import org.apidesign.bck2brwsr.vmtest.VMTest; jaroslav@381: import org.testng.annotations.Factory; jaroslav@381: jaroslav@381: /** jaroslav@381: * jaroslav@381: * @author Jaroslav Tulach jaroslav@381: */ jaroslav@381: public class MatrixTest { jaroslav@381: public MatrixTest() { jaroslav@381: } jaroslav@381: jaroslav@537: @Compare(scripting = false) jaroslav@537: public String tenThousandIterations() throws IOException { jaroslav@381: jaroslav@381: Matrix m1 = new Matrix(5); jaroslav@381: Matrix m2 = new Matrix(5); jaroslav@381: jaroslav@381: m1.generateData(); jaroslav@381: m2.generateData(); jaroslav@381: jaroslav@381: Matrix res = null; jaroslav@520: for (int i = 0; i < 10000; i++) { jaroslav@520: res = m1.multiply(m2); jaroslav@520: m1 = res; jaroslav@381: } jaroslav@381: jaroslav@381: StringBuilder sb = new StringBuilder(); jaroslav@381: res.printOn(sb); jaroslav@381: return sb.toString(); jaroslav@381: } jaroslav@381: jaroslav@381: @Factory jaroslav@381: public static Object[] create() { jaroslav@381: return VMTest.create(MatrixTest.class); jaroslav@381: } jaroslav@381: }