Don't run the Matrix multiplication test in Rhino - it is too slow model
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Wed, 23 Jan 2013 08:42:00 +0100
branchmodel
changeset 5377dbd0a097e44
parent 536 c4e6e1537d66
child 538 600a84e53009
child 596 d443b6c05a01
Don't run the Matrix multiplication test in Rhino - it is too slow
benchmarks/matrix-multiplication/src/test/java/org/apidesign/benchmark/matrixmul/MatrixTest.java
vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/Compare.java
vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/impl/CompareCase.java
     1.1 --- a/benchmarks/matrix-multiplication/src/test/java/org/apidesign/benchmark/matrixmul/MatrixTest.java	Wed Jan 23 08:12:20 2013 +0100
     1.2 +++ b/benchmarks/matrix-multiplication/src/test/java/org/apidesign/benchmark/matrixmul/MatrixTest.java	Wed Jan 23 08:42:00 2013 +0100
     1.3 @@ -30,7 +30,8 @@
     1.4      public MatrixTest() {
     1.5      }
     1.6  
     1.7 -    @Compare public String tenThousandIterations() throws IOException {
     1.8 +    @Compare(scripting = false) 
     1.9 +    public String tenThousandIterations() throws IOException {
    1.10      
    1.11          Matrix m1 = new Matrix(5);
    1.12          Matrix m2 = new Matrix(5);
     2.1 --- a/vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/Compare.java	Wed Jan 23 08:12:20 2013 +0100
     2.2 +++ b/vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/Compare.java	Wed Jan 23 08:42:00 2013 +0100
     2.3 @@ -24,7 +24,7 @@
     2.4  
     2.5  /** Can be applied on a method that yields a return value. 
     2.6   * Together with {@link VMTest#create} it can be used to write
     2.7 - * methods which are executed in real as well as JavaScript VMs and
     2.8 + * methods which are executed in real VM as well as JavaScript VMs and
     2.9   * their results are compared.
    2.10   *
    2.11   * @author Jaroslav Tulach <jtulach@netbeans.org>
    2.12 @@ -32,4 +32,14 @@
    2.13  @Retention(RetentionPolicy.RUNTIME)
    2.14  @Target(ElementType.METHOD)
    2.15  public @interface Compare {
    2.16 +    /** Specifies whether the system should internal JavaScript interpreter
    2.17 +     * as available via {@link javax.script.ScriptEngine}. Defaults to true,
    2.18 +     * but in some situations (benchmarking comes to my mind), one may set this
    2.19 +     * to <code>false</code>. In such case only browsers provided via
    2.20 +     * <code>vmtest.brwsrs</code> property are used. For example
    2.21 +     * <code>"vmtest.brwsrs=firefox,google-chrome"</code> would run the test
    2.22 +     * in HotSpot VM, firefox and chrome and would compare the results.
    2.23 +     * @return 
    2.24 +     */
    2.25 +    boolean scripting() default true;
    2.26  }
     3.1 --- a/vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/impl/CompareCase.java	Wed Jan 23 08:12:20 2013 +0100
     3.2 +++ b/vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/impl/CompareCase.java	Wed Jan 23 08:42:00 2013 +0100
     3.3 @@ -112,10 +112,12 @@
     3.4              return;
     3.5          }
     3.6          final Bck2BrwsrCase real = new Bck2BrwsrCase(m, "Java", null, false, null);
     3.7 -        final Bck2BrwsrCase js = new Bck2BrwsrCase(m, "JavaScript", l.javaScript(), false, null);
     3.8          ret.add(real);
     3.9 -        ret.add(js);
    3.10 -        ret.add(new CompareCase(m, real, js));
    3.11 +        if (c.scripting()) {
    3.12 +            final Bck2BrwsrCase js = new Bck2BrwsrCase(m, "JavaScript", l.javaScript(), false, null);
    3.13 +            ret.add(js);
    3.14 +            ret.add(new CompareCase(m, real, js));
    3.15 +        }
    3.16          for (String b : brwsr) {
    3.17              final Launcher s = l.brwsr(b);
    3.18              ret.add(s);