alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Java example source code file (build-benchmark.xml)

This example Java source code file (build-benchmark.xml) is included in the alvinalexander.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Learn more about this Java project at its project page.

Java - Java tags/keywords

copyright, free, general, gnu, license, nashorn, oracle, public, rhino, software, this, usa, xms, xmx

The build-benchmark.xml Java example source code

<?xml version="1.0" encoding="UTF-8"?>
<!--
 Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
 This code is free software; you can redistribute it and/or modify it
 under the terms of the GNU General Public License version 2 only, as
 published by the Free Software Foundation.
 
 This code 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 General Public License
 version 2 for more details (a copy is included in the LICENSE file that
 accompanied this code).
 
 You should have received a copy of the GNU General Public License version
 2 along with this work; if not, write to the Free Software Foundation,
 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 
 Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 or visit www.oracle.com if you need additional information or have any
 questions.
-->
<project name="nashorn-benchmarks" default="all" basedir="..">

  <target name="octane-init" depends="jar">
    <property name="octane-tests" value="box2d code-load crypto deltablue earley-boyer gbemu navier-stokes pdfjs raytrace regexp richards splay"/>
  </target>
  
  <!-- ignore benchmarks where rhino crashes -->
  <target name="octane-init-rhino" depends="jar">
    <property name="octane-tests" value="box2d code-load crypto deltablue earley-boyer gbemu navier-stokes raytrace regexp richards splay"/>
  </target>

  <!-- box2d -->
  <target name="octane-box2d" depends="jar">
    <antcall target="run-octane">
      <param name="octane-tests" value="box2d"/>
    </antcall>
  </target>

  <target name="octane-box2d-v8" depends="jar">
    <antcall target="run-octane-v8">
      <param name="octane-tests" value="box2d"/>
    </antcall>
  </target>

  <target name="octane-box2d-rhino" depends="jar">
    <antcall target="run-octane-rhino">
      <param name="octane-tests" value="box2d"/>
    </antcall>
  </target>


  <!-- code-load -->  
  <target name="octane-code-load" depends="jar">
    <antcall target="run-octane">
      <param name="octane-tests" value="code-load"/>
    </antcall>
  </target>

  <target name="octane-code-load-v8" depends="jar">
    <antcall target="run-octane-v8">
      <param name="octane-tests" value="code-load"/>
    </antcall>
  </target>

  <target name="octane-code-load-rhino" depends="jar">
    <antcall target="run-octane-rhino">
      <param name="octane-tests" value="code-load"/>
    </antcall>
  </target>


  <!-- crypto -->
  <target name="octane-crypto" depends="jar">
    <antcall target="run-octane">
      <param name="octane-tests" value="crypto"/>
    </antcall>
  </target>

  <target name="octane-crypto-v8" depends="jar">
    <antcall target="run-octane-v8">
      <param name="octane-tests" value="crypto"/>
    </antcall>
  </target>

  <target name="octane-crypto-rhino" depends="jar">
    <antcall target="run-octane-rhino">
      <param name="octane-tests" value="crypto"/>
    </antcall>
  </target>


  <!-- deltablue -->
  <target name="octane-deltablue" depends="jar">
    <antcall target="run-octane">
      <param name="octane-tests" value="deltablue"/>
    </antcall>
  </target>

  <target name="octane-deltablue-v8" depends="jar">
    <antcall target="run-octane-v8">
      <param name="octane-tests" value="deltablue"/>
    </antcall>
  </target>

  <target name="octane-deltablue-rhino" depends="jar">
    <antcall target="run-octane-rhino">
      <param name="octane-tests" value="deltablue"/>
    </antcall>
  </target>


  <!-- earley-boyer -->
  <target name="octane-earley-boyer" depends="jar">
    <antcall target="run-octane">
      <param name="octane-tests" value="earley-boyer"/>
    </antcall>
  </target>

  <target name="octane-earley-boyer-v8" depends="jar">
    <antcall target="run-octane-v8">
      <param name="octane-tests" value="earley-boyer"/>
    </antcall>
  </target>

  <target name="octane-earley-boyer-rhino" depends="jar">
    <antcall target="run-octane-rhino">
      <param name="octane-tests" value="earley-boyer"/>
    </antcall>
  </target>


  <!-- gbemu -->  
  <target name="octane-gbemu" depends="jar">
    <antcall target="run-octane">
      <param name="octane-tests" value="gbemu"/>
    </antcall>
  </target>

  <target name="octane-gbemu-v8" depends="jar">
    <antcall target="run-octane-v8">
      <param name="octane-tests" value="gbemu"/>
    </antcall>
  </target>

  <target name="octane-gbemu-rhino" depends="jar">
    <antcall target="run-octane-rhino">
      <param name="octane-tests" value="gbemu"/>
    </antcall>
  </target>


  <!-- mandreel -->  
  <target name="octane-mandreel" depends="jar">
    <antcall target="run-octane">
      <param name="octane-tests" value="mandreel"/>
    </antcall>
  </target>

  <target name="octane-mandreel-v8" depends="jar">
    <antcall target="run-octane-v8">
      <param name="octane-tests" value="mandreel"/>
    </antcall>
  </target>

  <target name="octane-mandreel-rhino" depends="jar">
    <antcall target="run-octane-rhino">
      <param name="octane-tests" value="mandreel"/>
    </antcall>
  </target>


  <!-- navier-stokes -->
  <target name="octane-navier-stokes" depends="jar">
    <antcall target="run-octane">
      <param name="octane-tests" value="navier-stokes"/>
    </antcall>
  </target>

  <target name="octane-navier-stokes-v8" depends="jar">
    <antcall target="run-octane-v8">
      <param name="octane-tests" value="navier-stokes"/>
    </antcall>
  </target>

  <target name="octane-navier-stokes-rhino" depends="jar">
    <antcall target="run-octane-rhino">
      <param name="octane-tests" value="navier-stokes"/>
    </antcall>
  </target>


  <!-- pdfjs -->  
  <target name="octane-pdfjs" depends="jar">
    <antcall target="run-octane">
      <param name="octane-tests" value="pdfjs"/>
    </antcall>
  </target>

  <target name="octane-pdfjs-v8" depends="jar">
    <antcall target="run-octane-v8">
      <param name="octane-tests" value="pdfjs"/>
    </antcall>
  </target>

  <target name="octane-pdfjs-rhino" depends="jar">
    <antcall target="run-octane-rhino">
      <param name="octane-tests" value="pdfjs"/>
    </antcall>
  </target>


  <!-- raytrace -->
  <target name="octane-raytrace" depends="jar">
    <antcall target="run-octane">
      <param name="octane-tests" value="raytrace"/>
    </antcall>
  </target>

  <target name="octane-raytrace-v8" depends="jar">
    <antcall target="run-octane-v8">
      <param name="octane-tests" value="raytrace"/>
    </antcall>
  </target>

  <target name="octane-raytrace-rhino" depends="jar">
    <antcall target="run-octane-rhino">
      <param name="octane-tests" value="raytrace"/>
    </antcall>
  </target>


  <!-- regexp -->
  <target name="octane-regexp" depends="jar">
    <antcall target="run-octane">
      <param name="octane-tests" value="regexp"/>
    </antcall>
  </target>

  <target name="octane-regexp-v8" depends="jar">
    <antcall target="run-octane-v8">
      <param name="octane-tests" value="regexp"/>
    </antcall>
  </target>

  <target name="octane-regexp-rhino" depends="jar">
    <antcall target="run-octane-rhino">
      <param name="octane-tests" value="regexp"/>
    </antcall>
  </target>


  <!-- richards -->
  <target name="octane-richards" depends="jar">
    <antcall target="run-octane">
      <param name="octane-tests" value="richards"/>
    </antcall>
  </target>

  <target name="octane-richards-v8" depends="jar">
    <antcall target="run-octane-v8">
      <param name="octane-tests" value="richards"/>
    </antcall>
  </target>

  <target name="octane-richards-rhino" depends="jar">
    <antcall target="run-octane-rhino">
      <param name="octane-tests" value="richards"/>
    </antcall>
  </target>


  <!-- splay -->
  <target name="octane-splay" depends="jar">
    <antcall target="run-octane">
      <param name="octane-tests" value="splay"/>
    </antcall>
  </target>

  <target name="octane-splay-v8" depends="jar">
    <antcall target="run-octane-v8">
      <param name="octane-tests" value="splay"/>
    </antcall>
  </target>

  <target name="octane-splay-rhino" depends="jar">
    <antcall target="run-octane-rhino">
      <param name="octane-tests" value="splay"/>
    </antcall>
  </target>

  <!-- splay -->
  <target name="octane-typescript" depends="jar">
    <antcall target="run-octane">
      <param name="octane-tests" value="typescript"/>
    </antcall>
  </target>

  <target name="octane-typescript-v8" depends="jar">
    <antcall target="run-octane-v8">
      <param name="octane-typescript" value="typescript"/>
    </antcall>
  </target>

  <target name="octane-typescript-rhino" depends="jar">
    <antcall target="run-octane-rhino">
      <param name="octane-tests" value="typescript"/>
    </antcall>
  </target>

  <!-- zlib -->
  <target name="octane-zlib" depends="jar">
    <antcall target="run-octane">
      <param name="octane-tests" value="zlib"/>
    </antcall>
  </target>

  <target name="octane-zlib-v8" depends="jar">
    <antcall target="run-octane-v8">
      <param name="octane-typescript" value="zlib"/>
    </antcall>
  </target>

  <target name="octane-zlib-rhino" depends="jar">
    <antcall target="run-octane-rhino">
      <param name="octane-tests" value="zlib"/>
    </antcall>
  </target>

  <!-- run octane benchmarks in a single process  -->
  <target name="octane-single-process" depends="octane-init">
    <antcall target="run-octane"/>
  </target>

  <!-- zlib excluded due to missing implementation of 'read' -->
  <target name="octane-separate-process" depends=
     "octane-box2d, octane-code-load, octane-crypto, 
      octane-deltablue, octane-earley-boyer, octane-gbemu,
      octane-mandreel, octane-navier-stokes, octane-pdfjs, 
      octane-raytrace, octane-regexp, octane-richards, 
      octane-splay, octane-typescript"/>

  <target name="--single-process" unless="${octane-test-sys-prop.separate.process}">
    <antcall target="octane-single-process"/>
  </target>
  <target name="--separate-process" if="${octane-test-sys-prop.separate.process}">
    <antcall target="octane-separate-process"/>
  </target>

  <!-- run 'octane' in single or separate processes based on config -->
  <target name="octane" depends="init, --single-process, --separate-process"/>

  <!-- run octane benchmarks using octane as runtime -->
  <target name="octane-v8" depends="octane-init">
    <antcall target="run-octane-v8"/>
  </target>

  <!-- run octane benchmarks using Rhino as runtime -->
  <target name="octane-rhino" depends="octane-init-rhino">
    <antcall target="run-octane-rhino"/>
  </target>
  
  <target name="run-octane">
    <java classname="${nashorn.shell.tool}"
          classpath="${run.test.classpath}"
          fork="true"
          dir=".">
      <jvmarg line="${ext.class.path}"/>
      <jvmarg line="${run.test.jvmargs.octane} -Xms${run.test.xms} -Xmx${run.test.xmx}"/>
      <arg value="${octane-test-sys-prop.test.js.framework}"/>
      <arg value="--"/>
      <arg value="${octane-tests}"/>
      <arg value="--runtime"/>
      <arg value="Nashorn"/>
      <arg value="--verbose"/>
      <arg value="--iterations 8"/>
    </java>
  </target>

  <target name="run-octane-v8">
    <exec executable="${v8.shell}">
      <arg value="${octane-test-sys-prop.test.js.framework}"/>
      <arg value="--"/>
      <arg value="${octane-tests}"/>      
      <arg value="--runtime"/>
      <arg value="v8"/>
      <arg value="--verbose"/>
      <arg value="--iterations 8"/>
    </exec>
  </target>

  <target name="run-octane-rhino">
    <java jar="${rhino.jar}"
          classpath="${run.test.classpath}"
          fork="true"
          dir=".">
      <jvmarg line="${run.test.jvmargs.octane} -Xms${run.test.xms} -Xmx${run.test.xmx}"/>
      <arg value="${octane-test-sys-prop.test.js.framework}"/>
      <arg value="${octane-tests}"/>
      <arg value="--runtime"/>
      <arg value="Rhino"/>
      <arg value="--verbose"/>
      <arg value="--iterations 8"/>
    </java>
  </target>

  <!-- run octane with all known runtimes for comparison -->
  <target name="octane-all" depends="octane, octane-v8, octane-rhino">
    <exec executable="${v8.shell}">
      <arg value="${octane-test-sys-prop.test.js.framework}"/>
      <arg value="${octane-tests}/"/>
    </exec>
  </target>
   
  <target name="sunspider-init" depends="jar">
    <fileset id="sunspider-set"
	     dir="${sunspider-test-sys-prop.test.js.roots}"
	     excludes="${sunspider-test-sys-prop.test.js.exclude.list}">
      <include name="**/*.js"/>
    </fileset>
    <pathconvert pathsep=" " property="sunspider-tests" refid="sunspider-set"/>
  </target>

  <!-- run sunspider with Nashorn -->
  <target name="sunspider" depends="sunspider-init">
    <java classname="${nashorn.shell.tool}"
          classpath="${run.test.classpath}"
          fork="true"
          dir=".">
      <jvmarg line="${ext.class.path}"/>
      <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
      <arg value="-timezone=PST"/>
      <arg value="--class-cache-size=50"/>
      <arg value="${sunspider-test-sys-prop.test.js.framework}"/>
      <arg value="--"/>
      <arg value="${sunspider-tests}/"/>
    </java>
  </target>

  <!-- run sunspider with v8 -->
  <target name="sunspider-v8" depends="sunspider-init">
    <exec executable="${v8.shell}">
      <arg value="${sunspider-test-sys-prop.test.js.framework}"/>
      <arg value="--"/>
      <arg value="${sunspider-tests}/"/>
    </exec>
  </target>

  <!-- run sunspider with Rhino -->
  <target name="sunspider-rhino" depends="sunspider-init">
    <java jar="${rhino.jar}"
          classpath="${run.test.classpath}"
          fork="true"
          dir=".">
      <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
      <arg value="${sunspider-test-sys-prop.test.js.framework}"/>
      <arg value="${sunspider-tests}/"/>
    </java>
  </target>

</project>

Other Java examples (source code examples)

Here is a short list of links related to this Java build-benchmark.xml source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.