build-benchmark.xml revision 1656:c261f8440c55
1<?xml version="1.0" encoding="UTF-8"?>
2
3<!--
4    Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
5    DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6
7    This code is free software; you can redistribute it and/or modify it
8    under the terms of the GNU General Public License version 2 only, as
9    published by the Free Software Foundation.
10
11    This code is distributed in the hope that it will be useful, but WITHOUT
12    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14    version 2 for more details (a copy is included in the LICENSE file that
15    accompanied this code).
16
17    You should have received a copy of the GNU General Public License version
18    2 along with this work; if not, write to the Free Software Foundation,
19    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
21    Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22    or visit www.oracle.com if you need additional information or have any
23    questions.
24-->
25
26
27<project
28    name="nashorn-benchmarks"
29    default="all"
30    basedir=".."
31    xmlns:if="ant:if">
32
33  <!--
34       Below are the octane benchmarks that should be run.
35       The ones that are excluded, as Nashorn currently has
36       some issues with them (functionality or performance)
37       are commented out
38  -->
39
40  <!-- box2d -->
41  <target name="octane-box2d" depends="octane-box2d-nashorn"/>
42  <target name="octane-box2d-nashorn" depends="jar">
43    <run-one cond="octane.benchmark.box2d" runtime="nashorn"/>
44  </target>
45  <target name="octane-box2d-v8" depends="jar">
46    <run-one cond="octane.benchmark.box2d" runtime="v8"/>
47  </target>
48  <target name="octane-box2d-rhino" depends="jar">
49    <run-one cond="octane.benchmark.box2d" runtime="rhino"/>
50  </target>
51
52  <!-- code-load -->
53  <target name="octane-code-load" depends="octane-code-load-nashorn"/>
54  <target name="octane-code-load-nashorn" depends="jar">
55    <run-one cond="octane.benchmark.code-load" runtime="nashorn"/>
56  </target>
57  <target name="octane-code-load-v8" depends="jar">
58    <run-one cond="octane.benchmark.code-load" runtime="v8"/>
59  </target>
60  <target name="octane-code-load-rhino" depends="jar">
61    <run-one cond="octane.benchmark.code-load" runtime="rhino"/>
62  </target>
63
64  <!-- crypto -->
65  <target name="octane-crypto" depends="octane-crypto-nashorn"/>
66  <target name="octane-crypto-nashorn" depends="jar">
67    <run-one cond="octane.benchmark.crypto" runtime="nashorn"/>
68  </target>
69  <target name="octane-crypto-v8" depends="jar">
70    <run-one cond="octane.benchmark.crypto" runtime="v8"/>
71  </target>
72  <target name="octane-crypto-rhino" depends="jar">
73    <run-one cond="octane.benchmark.crypto" runtime="rhino"/>
74  </target>
75
76  <!-- deltablue -->
77  <target name="octane-deltablue" depends="octane-deltablue-nashorn"/>
78  <target name="octane-deltablue-nashorn" depends="jar">
79    <run-one cond="octane.benchmark.deltablue" runtime="nashorn"/>
80  </target>
81  <target name="octane-deltablue-v8" depends="jar">
82    <run-one cond="octane.benchmark.deltablue" runtime="v8"/>
83  </target>
84  <target name="octane-deltablue-rhino" depends="jar">
85    <run-one cond="octane.benchmark.deltablue" runtime="rhino"/>
86  </target>
87
88  <!-- earley-boyer -->
89  <target name="octane-earley-boyer" depends="octane-earley-boyer-nashorn"/>
90  <target name="octane-earley-boyer-nashorn" depends="jar">
91    <run-one cond="octane.benchmark.earley-boyer" runtime="nashorn"/>
92  </target>
93  <target name="octane-earley-boyer-v8" depends="jar">
94    <run-one cond="octane.benchmark.earley-boyer" runtime="v8"/>
95  </target>
96  <target name="octane-earley-boyer-rhino" depends="jar">
97    <run-one cond="octane.benchmark.earley-boyer" runtime="rhino"/>
98  </target>
99  
100  <!-- gbemu -->
101  <target name="octane-gbemu" depends="octane-gbemu-nashorn"/>
102  <target name="octane-gbemu-nashorn" depends="jar">
103    <run-one cond="octane.benchmark.gbemu" runtime="nashorn"/>
104  </target>
105  <target name="octane-gbemu-v8" depends="jar">
106    <run-one cond="octane.benchmark.gbemu" runtime="v8"/>
107  </target>
108  <target name="octane-gbemu-rhino" depends="jar">
109    <run-one cond="octane.benchmark.gbemu" runtime="rhino"/>
110  </target>
111
112  <!-- mandreel -->
113  <target name="octane-mandreel" depends="octane-mandreel-nashorn"/>
114  <target name="octane-mandreel-nashorn" depends="jar">
115    <run-one cond="octane.benchmark.mandreel" runtime="nashorn"/>
116  </target>
117  <target name="octane-mandreel-v8" depends="jar">
118    <run-one cond="octane.benchmark.mandreel" runtime="v8"/>
119  </target>
120  <target name="octane-mandreel-rhino" depends="jar">
121    <run-one cond="octane.benchmark.mandreel" runtime="rhino"/>
122  </target>
123
124  <!-- navier-stokes -->
125  <target name="octane-navier-stokes" depends="octane-navier-stokes-nashorn"/>
126  <target name="octane-navier-stokes-nashorn" depends="jar">
127    <run-one cond="octane.benchmark.navier-stokes" runtime="nashorn"/>
128  </target>
129  <target name="octane-navier-stokes-v8" depends="jar">
130    <run-one cond="octane.benchmark.navier-stokes" runtime="v8"/>
131  </target>
132  <target name="octane-navier-stokes-rhino" depends="jar">
133    <run-one cond="octane.benchmark.navier-stokes" runtime="rhino"/>
134  </target>
135
136  <!-- pdfjs -->
137  <target name="octane-pdfjs" depends="octane-pdfjs-nashorn"/>
138  <target name="octane-pdfjs-nashorn" depends="jar">
139    <run-one cond="octane.benchmark.pdfjs" runtime="nashorn"/>
140  </target>
141  <target name="octane-pdfjs-v8" depends="jar">
142    <run-one cond="octane.benchmark.pdfjs" runtime="v8"/>
143  </target>
144  <target name="octane-pdfjs-rhino" depends="jar">
145    <run-one cond="octane.benchmark.pdfjs" runtime="rhino"/>
146  </target>
147
148  <!-- raytrace -->
149  <target name="octane-raytrace" depends="octane-raytrace-nashorn"/>
150  <target name="octane-raytrace-nashorn" depends="jar">
151    <run-one cond="octane.benchmark.raytrace" runtime="nashorn"/>
152  </target>
153  <target name="octane-raytrace-v8" depends="jar">
154    <run-one cond="octane.benchmark.raytrace" runtime="v8"/>
155  </target>
156  <target name="octane-raytrace-rhino" depends="jar">
157    <run-one cond="octane.benchmark.raytrace" runtime="rhino"/>
158  </target>
159
160  <!-- regexp -->
161  <target name="octane-regexp" depends="octane-regexp-nashorn"/>
162  <target name="octane-regexp-nashorn" depends="jar">
163    <run-one cond="octane.benchmark.regexp" runtime="nashorn"/>
164  </target>
165  <target name="octane-regexp-v8" depends="jar">
166    <run-one cond="octane.benchmark.regexp" runtime="v8"/>
167  </target>
168  <target name="octane-regexp-rhino" depends="jar">
169    <run-one cond="octane.benchmark.regexp" runtime="rhino"/>
170  </target>
171
172  <!-- richards -->
173  <target name="octane-richards" depends="octane-richards-nashorn"/>
174  <target name="octane-richards-nashorn" depends="jar">
175    <run-one cond="octane.benchmark.richards" runtime="nashorn"/>
176  </target>
177  <target name="octane-richards-v8" depends="jar">
178    <run-one cond="octane.benchmark.richards" runtime="v8"/>
179  </target>
180  <target name="octane-richards-rhino" depends="jar">
181    <run-one cond="octane.benchmark.richards" runtime="rhino"/>
182  </target>
183
184  <!-- splay -->
185  <target name="octane-splay" depends="octane-splay-nashorn"/>
186  <target name="octane-splay-nashorn" depends="jar">
187    <run-one cond="octane.benchmark.splay" runtime="nashorn"/>
188  </target>
189  <target name="octane-splay-v8" depends="jar">
190    <run-one cond="octane.benchmark.splay" runtime="v8"/>
191  </target>
192  <target name="octane-splay-rhino" depends="jar">
193    <run-one cond="octane.benchmark.splay" runtime="rhino"/>
194  </target>
195
196  <!-- typescript -->
197  <target name="octane-typescript" depends="octane-typescript-nashorn"/>
198  <target name="octane-typescript-nashorn" depends="jar">
199    <run-one cond="octane.benchmark.typescript" runtime="nashorn"/>
200  </target>
201  <target name="octane-typescript-v8" depends="jar">
202    <run-one cond="octane.benchmark.typescript" runtime="v8"/>
203  </target>
204  <target name="octane-typescript-rhino" depends="jar">
205    <run-one cond="octane.benchmark.typescript" runtime="rhino"/>
206  </target>
207
208  <!-- zlib -->
209  <target name="octane-zlib" depends="octane-zlib-nashorn"/>
210  <target name="octane-zlib-nashorn" depends="jar">
211    <run-one cond="octane.benchmark.zlib" runtime="nashorn"/>
212  </target>
213  <target name="octane-zlib-v8" depends="jar">
214    <run-one cond="octane.benchmark.zlib" runtime="v8"/>
215  </target>
216  <target name="octane-zlib-rhino" depends="jar">
217    <run-one cond="octane.benchmark.zlib" runtime="rhino"/>
218  </target>
219
220  <!--
221      Benchmark runners for one or more benchmarks, single
222      or multiple process
223  -->
224
225  <target name="octane-process-separate" if="${octane-test-sys-prop.separate.process}">
226    <echo message="Running each benchmark in separate processes, starting new JVMs for each."/>
227    <script language="javascript"><![CDATA[
228      var props = [];
229
230      for (var prop in project.getProperties()) {
231        if (prop.startsWith("octane.benchmark.")) {
232          props.push(prop);
233        }
234      }
235
236      //sort benchmark props in alphabetical order by name
237      props.sort(function(a, b) {
238        if (a < b) {
239          return -1;
240        } else if (a > b) {
241          return 1;
242        } else {
243           return 0;
244        }
245      });
246      
247      var runtime = project.getProperty("runtime");
248
249      for (var i in props) {
250        var task = project.createTask("run-one");
251	// workaround for https://issues.apache.org/bugzilla/show_bug.cgi?id=53831, still not fixed
252        if (task.getOwningTarget() == null) {
253	  task.setOwningTarget(self.getOwningTarget());
254	}
255        var prop = props[i];
256        task.setDynamicAttribute("cond", prop);
257        task.setDynamicAttribute("runtime", runtime);
258	task.perform();
259      }
260    ]]></script>
261  </target>
262
263  <target name="octane-process-single" unless="${octane-test-sys-prop.separate.process}">
264    <echo message="Running all benchmarks in the same process."/>
265    <pathconvert property="octane.benchmarks" pathsep=" ">
266      <propertyset>
267    <propertyref prefix="octane.benchmark."/>
268      </propertyset>
269    </pathconvert>
270    <antcall target="run-octane${runtime}">
271      <param name="octane-tests" value="${octane.benchmarks}"/>
272    </antcall>
273  </target>
274
275  <!--
276       run 'octane' in single or separate processes based on config
277       This uses nashorn as the default runtime
278  -->
279  <target name="octane-nashorn" depends="jar">
280    <property name="runtime" value="nashorn"/>
281    <!--
282       Temporarily disabled because ant script tag is broken with
283       jdk9. See also: JDK-8152533.
284
285       <antcall target="octane-process-separate"/>
286       <antcall target="octane-process-single"/>
287    -->
288    <echo message="octane target temporarily disabled"/>
289  </target>
290
291  <!-- alias for 'octane' -->
292  <target name="octane" depends="octane-nashorn"/>
293
294  <!-- run octane benchmarks using octane as runtime -->
295  <target name="octane-v8" depends="jar">
296    <property name="runtime" value="v8"/>
297    <antcall target="octane-process-separate"/>
298    <antcall target="octane-process-single"/>
299  </target>
300
301  <!-- run octane benchmarks using Rhino as runtime -->
302  <target name="octane-rhino" depends="jar">
303    <property name="runtime" value="rhino"/>
304    <antcall target="octane-process-separate"/>
305    <antcall target="octane-process-single"/>
306  </target>
307
308  <macrodef name="run-one">
309    <attribute name="cond"/>
310    <attribute name="runtime" default=""/>
311    <sequential>
312	<antcall target="run-octane-@{runtime}" if:set="@{cond}">
313	  <param name="octane-tests" value="${@{cond}}"/>
314	</antcall>
315    </sequential>
316  </macrodef>
317
318  <target name="run-octane-nashorn">
319    <java classname="${nashorn.shell.tool}"
320          classpath="${run.test.classpath}"
321          fork="true"
322          dir=".">
323      <jvmarg line="${boot.class.path}"/>
324      <jvmarg line="${run.test.jvmargs.octane} -Xms${run.test.xms} -Xmx${run.test.xmx}"/>
325      <!-- pass on all properties prefixed with 'nashorn' to the runtime -->
326      <syspropertyset>
327        <propertyref prefix="nashorn."/>
328      </syspropertyset>
329      <arg value="${octane-test-sys-prop.test.js.framework}"/>
330      <arg value="-scripting"/>
331      <arg value="--"/>
332      <arg value="${octane-tests}"/>
333      <arg value="--runtime"/>
334      <arg value="nashorn"/>
335      <arg value="--verbose"/>
336      <arg value="--iterations ${octane.iterations}"/>
337    </java>
338  </target>
339
340  <target name="run-octane-v8">
341    <exec executable="${v8.shell}">
342      <arg value="${octane-test-sys-prop.test.js.framework}"/>
343      <arg value="--"/>
344      <arg value="${octane-tests}"/>
345      <arg value="--runtime"/>
346      <arg value="v8"/>
347      <arg value="--verbose"/>
348      <arg value="--iterations ${octane.iterations}"/>
349    </exec>
350  </target>
351
352  <target name="run-octane-rhino">
353    <java jar="${rhino.jar}"
354          classpath="${run.test.classpath}"
355          fork="true"
356          dir=".">
357      <jvmarg line="${run.test.jvmargs.octane} -Xms${run.test.xms} -Xmx${run.test.xmx}"/>
358      <arg value="-opt"/>
359      <arg value="9"/>
360      <arg value="${octane-test-sys-prop.test.js.framework}"/>
361      <arg value="${octane-tests}"/>
362      <arg value="--runtime"/>
363      <arg value="rhino"/>
364      <arg value="--verbose"/>
365      <arg value="--iterations ${octane.iterations}"/>
366    </java>
367  </target>
368
369  <!-- run octane with all known runtimes for comparison -->
370  <target name="octane-all" depends="octane, octane-v8, octane-rhino">
371    <exec executable="${v8.shell}">
372      <arg value="${octane-test-sys-prop.test.js.framework}"/>
373      <arg value="${octane-tests}/"/>
374    </exec>
375  </target>
376
377  <target name="sunspider-init" depends="jar">
378    <fileset id="sunspider-set"
379         dir="${sunspider-test-sys-prop.test.js.roots}"
380         excludes="${sunspider-test-sys-prop.test.js.exclude.list}">
381      <include name="**/*.js"/>
382    </fileset>
383    <pathconvert pathsep=" " property="sunspider-tests" refid="sunspider-set"/>
384  </target>
385
386  <!--- SUNSPIDER JOB BELOW -->
387
388  <!-- run sunspider with Nashorn -->
389  <target name="sunspider" depends="sunspider-nashorn"/>
390
391  <target name="sunspider-nashorn" depends="sunspider-init">
392    <java classname="${nashorn.shell.tool}"
393          classpath="${run.test.classpath}"
394          fork="true"
395          dir=".">
396      <jvmarg line="${boot.class.path}"/>
397      <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
398      <arg value="-timezone=PST"/>
399      <arg value="--class-cache-size=50"/>
400      <arg value="${sunspider-test-sys-prop.test.js.framework}"/>
401      <arg value="--"/>
402      <arg value="${sunspider-tests}/"/>
403      <arg value="--verbose"/>
404      <arg value="--times"/>
405      <arg value="${sunspider.iterations}"/>
406    </java>
407  </target>
408
409  <!-- run sunspider with v8 -->
410  <target name="sunspider-v8" depends="sunspider-init">
411    <exec executable="${v8.shell}">
412      <arg value="${sunspider-test-sys-prop.test.js.framework}"/>
413      <arg value="--"/>
414      <arg value="${sunspider-tests}/"/>
415      <arg value="--verbose"/>
416      <arg value="--times"/>
417      <arg value="${sunspider.iterations}"/>
418    </exec>
419  </target>
420
421  <!-- run sunspider with Rhino -->
422  <target name="sunspider-rhino" depends="sunspider-init">
423    <java jar="${rhino.jar}"
424          classpath="${run.test.classpath}"
425          fork="true"
426          dir=".">
427      <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
428      <arg value="-opt"/>
429      <arg value="9"/>
430      <arg value="${sunspider-test-sys-prop.test.js.framework}"/>
431      <arg value="${sunspider-tests}/"/>
432      <arg value="--verbose"/>
433      <arg value="--times"/>
434      <arg value="${sunspider.iterations}"/>
435    </java>
436  </target>
437
438</project>
439