Merging benchmarks branch into trunk, it seems to be usable. Just run mvn test -Dbck2brwsr.runBenchmarks.browsers=firefox,google-chrome etc.
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/benchmarks/matrix-multiplication/jsTestDriver.conf Thu Dec 13 08:43:52 2012 +0100
1.3 @@ -0,0 +1,5 @@
1.4 +server: http://localhost:9876
1.5 +
1.6 +load:
1.7 + - target/classes/org/apidesign/benchmark/matrixmul/*.js
1.8 +
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/benchmarks/matrix-multiplication/nbactions.xml Thu Dec 13 08:43:52 2012 +0100
2.3 @@ -0,0 +1,29 @@
2.4 +<?xml version="1.0" encoding="UTF-8"?>
2.5 +<!--
2.6 +
2.7 + Back 2 Browser Bytecode Translator
2.8 + Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
2.9 +
2.10 + This program is free software: you can redistribute it and/or modify
2.11 + it under the terms of the GNU General Public License as published by
2.12 + the Free Software Foundation, version 2 of the License.
2.13 +
2.14 + This program is distributed in the hope that it will be useful,
2.15 + but WITHOUT ANY WARRANTY; without even the implied warranty of
2.16 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2.17 + GNU General Public License for more details.
2.18 +
2.19 + You should have received a copy of the GNU General Public License
2.20 + along with this program. Look for COPYING file in the top folder.
2.21 + If not, see http://opensource.org/licenses/GPL-2.0.
2.22 +
2.23 +-->
2.24 +<actions>
2.25 + <action>
2.26 + <actionName>run</actionName>
2.27 + <goals>
2.28 + <goal>process-classes</goal>
2.29 + <goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
2.30 + </goals>
2.31 + </action>
2.32 +</actions>
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/benchmarks/matrix-multiplication/pom.xml Thu Dec 13 08:43:52 2012 +0100
3.3 @@ -0,0 +1,111 @@
3.4 +<?xml version="1.0"?>
3.5 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3.6 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3.7 + <modelVersion>4.0.0</modelVersion>
3.8 +
3.9 + <groupId>org.apidesign.bck2brwsr</groupId>
3.10 + <artifactId>matrix.multiplication</artifactId>
3.11 + <version>0.3-SNAPSHOT</version>
3.12 + <packaging>jar</packaging>
3.13 +
3.14 + <name>Matrix multiplication</name>
3.15 +
3.16 + <properties>
3.17 + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3.18 + </properties>
3.19 +
3.20 + <build>
3.21 + <plugins>
3.22 + <plugin>
3.23 + <groupId>org.apache.maven.plugins</groupId>
3.24 + <artifactId>maven-compiler-plugin</artifactId>
3.25 + <version>2.3.2</version>
3.26 + <configuration>
3.27 + <source>1.7</source>
3.28 + <target>1.7</target>
3.29 + </configuration>
3.30 + </plugin>
3.31 +
3.32 + <plugin>
3.33 + <groupId>org.apidesign.bck2brwsr</groupId>
3.34 + <artifactId>mojo</artifactId>
3.35 + <version>0.3-SNAPSHOT</version>
3.36 + <executions>
3.37 + <execution>
3.38 + <goals>
3.39 + <goal>j2js</goal>
3.40 + </goals>
3.41 + </execution>
3.42 + </executions>
3.43 + </plugin>
3.44 +
3.45 + </plugins>
3.46 + </build>
3.47 +
3.48 + <profiles>
3.49 + <profile>
3.50 + <id>run-benchmarks</id>
3.51 + <activation>
3.52 + <property><name>bck2brwsr.runBenchmarks.browsers</name></property>
3.53 + </activation>
3.54 +
3.55 + <build>
3.56 + <plugins>
3.57 +
3.58 + <plugin>
3.59 + <groupId>com.googlecode.jstd-maven-plugin</groupId>
3.60 + <artifactId>jstd-maven-plugin</artifactId>
3.61 + <version>1.3.2.5</version>
3.62 + <configuration>
3.63 + <port>9876</port>
3.64 + <browser>${bck2brwsr.runBenchmarks.browsers}</browser>
3.65 + <browserTimeout>720</browserTimeout>
3.66 + <tests>all</tests>
3.67 + <config>jsTestDriver.conf</config>
3.68 + <reset>true</reset>
3.69 + <testOutput>${basedir}/target/testOutput</testOutput>
3.70 + <!-- runnerMode>DEBUG</runnerMode -->
3.71 + </configuration>
3.72 + <executions>
3.73 + <execution>
3.74 + <id>run-tests</id>
3.75 + <goals>
3.76 + <goal>test</goal>
3.77 + </goals>
3.78 + </execution>
3.79 + </executions>
3.80 + </plugin>
3.81 +
3.82 + </plugins>
3.83 + </build>
3.84 + </profile>
3.85 + </profiles>
3.86 +
3.87 + <dependencies>
3.88 + <dependency>
3.89 + <groupId>org.apidesign.bck2brwsr</groupId>
3.90 + <artifactId>emul</artifactId>
3.91 + <version>0.3-SNAPSHOT</version>
3.92 + </dependency>
3.93 + <dependency>
3.94 + <groupId>com.googlecode.jstd-maven-plugin</groupId>
3.95 + <artifactId>jstd-maven-plugin</artifactId>
3.96 + <version>1.3.2.5</version>
3.97 + <scope>test</scope>
3.98 + </dependency>
3.99 + </dependencies>
3.100 +
3.101 + <repositories>
3.102 + <repository>
3.103 + <id>jstd-maven-plugin google code repo</id>
3.104 + <url>http://jstd-maven-plugin.googlecode.com/svn/maven2</url>
3.105 + </repository>
3.106 + </repositories>
3.107 + <pluginRepositories>
3.108 + <pluginRepository>
3.109 + <id>jstd-maven-plugin google code repo</id>
3.110 + <url>http://jstd-maven-plugin.googlecode.com/svn/maven2</url>
3.111 + </pluginRepository>
3.112 + </pluginRepositories>
3.113 +
3.114 +</project>
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/benchmarks/matrix-multiplication/src/main/java/org/apidesign/benchmark/matrixmul/Main.java Thu Dec 13 08:43:52 2012 +0100
4.3 @@ -0,0 +1,42 @@
4.4 +/**
4.5 + * Back 2 Browser Bytecode Translator
4.6 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
4.7 + *
4.8 + * This program is free software: you can redistribute it and/or modify
4.9 + * it under the terms of the GNU General Public License as published by
4.10 + * the Free Software Foundation, version 2 of the License.
4.11 + *
4.12 + * This program is distributed in the hope that it will be useful,
4.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4.15 + * GNU General Public License for more details.
4.16 + *
4.17 + * You should have received a copy of the GNU General Public License
4.18 + * along with this program. Look for COPYING file in the top folder.
4.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
4.20 + */
4.21 +package org.apidesign.benchmark.matrixmul;
4.22 +
4.23 +public class Main {
4.24 +
4.25 + public static final int ITERATION_COUNT = 100000;
4.26 +
4.27 + public static void main(String[] args) {
4.28 + Matrix m1 = new Matrix(5);
4.29 + Matrix m2 = new Matrix(5);
4.30 +
4.31 + m1.generateData();
4.32 + m2.generateData();
4.33 +
4.34 + //m1.printOn(System.out);
4.35 + //System.out.println("x");
4.36 + //m2.printOn(System.out);
4.37 +
4.38 + for (int i = 0; i < ITERATION_COUNT; i++) {
4.39 + m1.multiply(m2);
4.40 + }
4.41 +
4.42 + //System.out.println("=");
4.43 + //m1.printOn(System.out);
4.44 + }
4.45 +}
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/benchmarks/matrix-multiplication/src/main/java/org/apidesign/benchmark/matrixmul/Matrix.java Thu Dec 13 08:43:52 2012 +0100
5.3 @@ -0,0 +1,81 @@
5.4 +/**
5.5 + * Back 2 Browser Bytecode Translator
5.6 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
5.7 + *
5.8 + * This program is free software: you can redistribute it and/or modify
5.9 + * it under the terms of the GNU General Public License as published by
5.10 + * the Free Software Foundation, version 2 of the License.
5.11 + *
5.12 + * This program is distributed in the hope that it will be useful,
5.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
5.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5.15 + * GNU General Public License for more details.
5.16 + *
5.17 + * You should have received a copy of the GNU General Public License
5.18 + * along with this program. Look for COPYING file in the top folder.
5.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
5.20 + */
5.21 +package org.apidesign.benchmark.matrixmul;
5.22 +
5.23 +//import java.io.PrintStream;
5.24 +//import java.util.Random;
5.25 +
5.26 +public class Matrix {
5.27 +
5.28 + private final int rank;
5.29 + private float data[][];
5.30 +
5.31 + public Matrix(int r) {
5.32 + rank = r;
5.33 + data = new float[r][r];
5.34 + }
5.35 +
5.36 + public void setElement(int i, int j, float value) {
5.37 + data[i][j] = value;
5.38 + }
5.39 + public float getElement(int i, int j) {
5.40 + return data[i][j];
5.41 + }
5.42 +
5.43 + public void generateData() {
5.44 + //final Random rand = new Random();
5.45 + //final int x = 10;
5.46 + for (int i = 0; i < rank; i++) {
5.47 + for (int j = 0; j < rank; j++) {
5.48 + data[i][j] = i + j;
5.49 + }
5.50 + }
5.51 + }
5.52 +
5.53 + public Matrix multiply(Matrix m) {
5.54 + if (rank != m.rank) {
5.55 + throw new IllegalArgumentException("Rank doesn't match");
5.56 + }
5.57 +
5.58 + final float res[][] = new float[rank][rank];
5.59 + for (int i = 0; i < rank; i++) {
5.60 + for (int j = 0; j < rank; j++) {
5.61 + float ij = 0;
5.62 + for (int q = 0; q < rank; q++) {
5.63 + ij += data[i][q] * m.data[q][j];
5.64 + }
5.65 + res[i][j] = ij;
5.66 + }
5.67 + }
5.68 + data = res;
5.69 +
5.70 + return this;
5.71 + }
5.72 +
5.73 + /*
5.74 + public void printOn(PrintStream s) {
5.75 + for (int i = 0; i < rank; i++) {
5.76 + for (int j = 0; j < rank; j++) {
5.77 + s.printf("%f ", data[i][j]);
5.78 + }
5.79 + s.println();
5.80 + }
5.81 + }
5.82 + */
5.83 +
5.84 +}
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/benchmarks/matrix-multiplication/src/main/resources/org/apidesign/benchmark/matrixmul/multiplication-test.js Thu Dec 13 08:43:52 2012 +0100
6.3 @@ -0,0 +1,25 @@
6.4 +/*
6.5 + * Back 2 Browser Bytecode Translator
6.6 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
6.7 + *
6.8 + * This program is free software: you can redistribute it and/or modify
6.9 + * it under the terms of the GNU General Public License as published by
6.10 + * the Free Software Foundation, version 2 of the License.
6.11 + *
6.12 + * This program is distributed in the hope that it will be useful,
6.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6.15 + * GNU General Public License for more details.
6.16 + *
6.17 + * You should have received a copy of the GNU General Public License
6.18 + * along with this program. Look for COPYING file in the top folder.
6.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
6.20 + */
6.21 +MatrixTest = TestCase("MatrixTest");
6.22 +
6.23 +
6.24 +MatrixTest.prototype.testMultiplication = function() {
6.25 + var vm = new bck2brwsr();
6.26 + var x = vm.loadClass("org.apidesign.benchmark.matrixmul.Main");
6.27 + x.main__V_3Ljava_lang_String_2(null);
6.28 +};
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/benchmarks/pom.xml Thu Dec 13 08:43:52 2012 +0100
7.3 @@ -0,0 +1,17 @@
7.4 +<?xml version="1.0" encoding="UTF-8"?>
7.5 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
7.6 + <modelVersion>4.0.0</modelVersion>
7.7 + <parent>
7.8 + <artifactId>bck2brwsr</artifactId>
7.9 + <groupId>org.apidesign</groupId>
7.10 + <version>0.3-SNAPSHOT</version>
7.11 + </parent>
7.12 + <groupId>org.apidesign.bck2brwsr</groupId>
7.13 + <artifactId>benchmarks</artifactId>
7.14 + <version>0.3-SNAPSHOT</version>
7.15 + <packaging>pom</packaging>
7.16 + <name>Performance benchmarks</name>
7.17 + <modules>
7.18 + <module>matrix-multiplication</module>
7.19 + </modules>
7.20 +</project>
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/benchmarks/run-firefox.sh Thu Dec 13 08:43:52 2012 +0100
8.3 @@ -0,0 +1,20 @@
8.4 +#!/bin/bash
8.5 +#
8.6 +# Back 2 Browser Bytecode Translator
8.7 +# Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
8.8 +#
8.9 +# This program is free software: you can redistribute it and/or modify
8.10 +# it under the terms of the GNU General Public License as published by
8.11 +# the Free Software Foundation, version 2 of the License.
8.12 +#
8.13 +# This program is distributed in the hope that it will be useful,
8.14 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
8.15 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8.16 +# GNU General Public License for more details.
8.17 +#
8.18 +# You should have received a copy of the GNU General Public License
8.19 +# along with this program. Look for COPYING file in the top folder.
8.20 +# If not, see http://opensource.org/licenses/GPL-2.0.
8.21 +#
8.22 +
8.23 +/usr/bin/firefox --display=`echo $DISPLAY` "$@"
9.1 --- a/pom.xml Wed Dec 12 09:09:42 2012 +0100
9.2 +++ b/pom.xml Thu Dec 13 08:43:52 2012 +0100
9.3 @@ -13,6 +13,7 @@
9.4 <module>mojo</module>
9.5 <module>javaquery</module>
9.6 <module>javap</module>
9.7 + <module>benchmarks</module>
9.8 </modules>
9.9 <licenses>
9.10 <license>