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 <target name="-define-nashorn-task"> 221 <ant dir="${nashorntask.dir}" inheritAll="false"/> 222 <taskdef name="nashorn" classname="jdk.nashorn.ant.NashornTask" 223 classpath="${nashorntask.dist.dir}/nashorntask.jar"/> 224 </target> 225 226 <!-- 227 Benchmark runners for one or more benchmarks, single 228 or multiple process 229 --> 230 231 <target name="octane-process-separate" if="${octane-test-sys-prop.separate.process}" 232 depends="-define-nashorn-task"> 233 <echo message="Running each benchmark in separate processes, starting new JVMs for each."/> 234 <nashorn><![CDATA[ 235 var props = []; 236 237 for (var prop in project.getProperties()) { 238 if (prop.startsWith("octane.benchmark.")) { 239 props.push(prop); 240 } 241 } 242 243 //sort benchmark props in alphabetical order by name 244 props.sort(function(a, b) { 245 if (a < b) { 246 return -1; 247 } else if (a > b) { 248 return 1; 249 } else { 250 return 0; 251 } 252 }); 253 254 var runtime = project.getProperty("runtime"); 255 256 for (var i in props) { 257 var task = project.createTask("run-one"); 258 // workaround for https://issues.apache.org/bugzilla/show_bug.cgi?id=53831, still not fixed 259 if (task.getOwningTarget() == null) { 260 task.setOwningTarget(self.getOwningTarget()); 261 } 262 var prop = props[i]; 263 task.setDynamicAttribute("cond", prop); 264 task.setDynamicAttribute("runtime", runtime); 265 task.perform(); 266 } 267 ]]></nashorn> 268 </target> 269 270 <target name="octane-process-single" unless="${octane-test-sys-prop.separate.process}"> 271 <echo message="Running all benchmarks in the same process."/> 272 <pathconvert property="octane.benchmarks" pathsep=" "> 273 <propertyset> 274 <propertyref prefix="octane.benchmark."/> 275 </propertyset> 276 </pathconvert> 277 <antcall target="run-octane${runtime}"> 278 <param name="octane-tests" value="${octane.benchmarks}"/> 279 </antcall> 280 </target> 281 282 <!-- 283 run 'octane' in single or separate processes based on config 284 This uses nashorn as the default runtime 285 --> 286 <target name="octane-nashorn" depends="jar"> 287 <property name="runtime" value="nashorn"/> 288 <antcall target="octane-process-separate"/> 289 <antcall target="octane-process-single"/> 290 </target> 291 292 <!-- alias for 'octane' --> 293 <target name="octane" depends="octane-nashorn"/> 294 295 <!-- run octane benchmarks using octane as runtime --> 296 <target name="octane-v8" depends="jar"> 297 <property name="runtime" value="v8"/> 298 <antcall target="octane-process-separate"/> 299 <antcall target="octane-process-single"/> 300 </target> 301 302 <!-- run octane benchmarks using Rhino as runtime --> 303 <target name="octane-rhino" depends="jar"> 304 <property name="runtime" value="rhino"/> 305 <antcall target="octane-process-separate"/> 306 <antcall target="octane-process-single"/> 307 </target> 308 309 <macrodef name="run-one"> 310 <attribute name="cond"/> 311 <attribute name="runtime" default=""/> 312 <sequential> 313 <antcall target="run-octane-@{runtime}" if:set="@{cond}"> 314 <param name="octane-tests" value="${@{cond}}"/> 315 </antcall> 316 </sequential> 317 </macrodef> 318 319 <target name="run-octane-nashorn"> 320 <java classname="${nashorn.shell.tool}" 321 classpath="${run.test.classpath}" 322 fork="true"> 323 <jvmarg line="${run.test.jvmargs.octane} -Xms${run.test.xms} -Xmx${run.test.xmx}"/> 324 <!-- pass on all properties prefixed with 'nashorn' to the runtime --> 325 <syspropertyset> 326 <propertyref prefix="nashorn."/> 327 </syspropertyset> 328 <arg value="${octane-test-sys-prop.test.js.framework}"/> 329 <arg value="-scripting"/> 330 <arg value="--"/> 331 <arg value="${octane-tests}"/> 332 <arg value="--runtime"/> 333 <arg value="nashorn"/> 334 <arg value="--verbose"/> 335 <arg value="--iterations ${octane.iterations}"/> 336 </java> 337 </target> 338 339 <target name="run-octane-v8"> 340 <exec executable="${v8.shell}"> 341 <arg value="${octane-test-sys-prop.test.js.framework}"/> 342 <arg value="--"/> 343 <arg value="${octane-tests}"/> 344 <arg value="--runtime"/> 345 <arg value="v8"/> 346 <arg value="--verbose"/> 347 <arg value="--iterations ${octane.iterations}"/> 348 </exec> 349 </target> 350 351 <target name="run-octane-rhino"> 352 <java jar="${rhino.jar}" 353 classpath="${run.test.classpath}" 354 fork="true" 355 dir="."> 356 <jvmarg line="${run.test.jvmargs.octane} -Xms${run.test.xms} -Xmx${run.test.xmx}"/> 357 <arg value="-opt"/> 358 <arg value="9"/> 359 <arg value="${octane-test-sys-prop.test.js.framework}"/> 360 <arg value="${octane-tests}"/> 361 <arg value="--runtime"/> 362 <arg value="rhino"/> 363 <arg value="--verbose"/> 364 <arg value="--iterations ${octane.iterations}"/> 365 </java> 366 </target> 367 368 <!-- run octane with all known runtimes for comparison --> 369 <target name="octane-all" depends="octane, octane-v8, octane-rhino"> 370 <exec executable="${v8.shell}"> 371 <arg value="${octane-test-sys-prop.test.js.framework}"/> 372 <arg value="${octane-tests}/"/> 373 </exec> 374 </target> 375 376 <target name="sunspider-init" depends="jar"> 377 <fileset id="sunspider-set" 378 dir="${sunspider-test-sys-prop.test.js.roots}" 379 excludes="${sunspider-test-sys-prop.test.js.exclude.list}"> 380 <include name="**/*.js"/> 381 </fileset> 382 <pathconvert pathsep=" " property="sunspider-tests" refid="sunspider-set"/> 383 </target> 384 385 <!--- SUNSPIDER JOB BELOW --> 386 387 <!-- run sunspider with Nashorn --> 388 <target name="sunspider" depends="sunspider-nashorn"/> 389 390 <target name="sunspider-nashorn" depends="sunspider-init"> 391 <java classname="${nashorn.shell.tool}" 392 classpath="${run.test.classpath}" 393 fork="true"> 394 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/> 395 <arg value="-timezone=PST"/> 396 <arg value="--class-cache-size=50"/> 397 <arg value="${sunspider-test-sys-prop.test.js.framework}"/> 398 <arg value="--"/> 399 <arg value="${sunspider-tests}/"/> 400 <arg value="--verbose"/> 401 <arg value="--times"/> 402 <arg value="${sunspider.iterations}"/> 403 </java> 404 </target> 405 406 <!-- run sunspider with v8 --> 407 <target name="sunspider-v8" depends="sunspider-init"> 408 <exec executable="${v8.shell}"> 409 <arg value="${sunspider-test-sys-prop.test.js.framework}"/> 410 <arg value="--"/> 411 <arg value="${sunspider-tests}/"/> 412 <arg value="--verbose"/> 413 <arg value="--times"/> 414 <arg value="${sunspider.iterations}"/> 415 </exec> 416 </target> 417 418 <!-- run sunspider with Rhino --> 419 <target name="sunspider-rhino" depends="sunspider-init"> 420 <java jar="${rhino.jar}" 421 classpath="${run.test.classpath}" 422 fork="true" 423 dir="."> 424 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/> 425 <arg value="-opt"/> 426 <arg value="9"/> 427 <arg value="${sunspider-test-sys-prop.test.js.framework}"/> 428 <arg value="${sunspider-tests}/"/> 429 <arg value="--verbose"/> 430 <arg value="--times"/> 431 <arg value="${sunspider.iterations}"/> 432 </java> 433 </target> 434 435 </project>