summaryrefslogtreecommitdiff
path: root/test/benchmark
diff options
context:
space:
mode:
authorIulian Dragos <jaguarul@gmail.com>2004-10-21 09:50:39 +0000
committerIulian Dragos <jaguarul@gmail.com>2004-10-21 09:50:39 +0000
commitbb73b041480e06dac7fc1e851776a3654541e594 (patch)
treef78fcf08525241a104caf364f4aec43b54f3ed75 /test/benchmark
parentd67d3c2ebad1a373c6e8abb7603394f8d7444e1a (diff)
downloadscala-bb73b041480e06dac7fc1e851776a3654541e594.tar.gz
scala-bb73b041480e06dac7fc1e851776a3654541e594.tar.bz2
scala-bb73b041480e06dac7fc1e851776a3654541e594.zip
Scala benchmark suite added
Diffstat (limited to 'test/benchmark')
-rw-r--r--test/benchmark/build.xml22
-rw-r--r--test/benchmark/predef.xml78
2 files changed, 100 insertions, 0 deletions
diff --git a/test/benchmark/build.xml b/test/benchmark/build.xml
new file mode 100644
index 0000000000..da7645d81e
--- /dev/null
+++ b/test/benchmark/build.xml
@@ -0,0 +1,22 @@
+<project name="benchmark" default="run.benchmark">
+
+ <import file="predef.xml"/>
+
+ <target name="init" depends="clean.benchmark">
+ <mkdir dir="${benchmark.classes.dir}"/>
+ </target>
+
+ <target name="clean.benchmark"
+ description="Clean the files generated for the benchmark classes">
+ <delete dir="${benchmark.classes.dir}"/>
+ </target>
+
+ <target name="run.benchmark"
+ description="Run the benchmark suite">
+
+ <subant inheritAll="false">
+ <fileset dir="${benchmark.sources.dir}" includes="*/build.xml"/>
+ </subant>
+ </target>
+
+</project>
diff --git a/test/benchmark/predef.xml b/test/benchmark/predef.xml
new file mode 100644
index 0000000000..72bab526fe
--- /dev/null
+++ b/test/benchmark/predef.xml
@@ -0,0 +1,78 @@
+<project name="predef">
+
+ <!-- Redefine accordingly to where you checked out your scala files -->
+ <!-- scala.home should point to the directory that contains the -->
+ <!-- "benchmark" directory -->
+ <property name="scala.home" value="${user.home}/scala"/>
+
+ <!-- Define some basic paths -->
+ <property name="benchmark.home" value="${scala.home}/test/benchmark"/>
+ <property name="benchmark.sources.dir"
+ value="${benchmark.home}/sources"/>
+ <property name="benchmark.classes.dir"
+ value="${benchmark.home}/classes"/>
+ <property name="log.file"
+ value="${benchmark.home}/times/times.log"/>
+
+ <!-- Define the scalac task -->
+ <taskdef name="scalac"
+ classname="scala.tools.scala4ant.ScalacTask$class"/>
+
+ <!-- Define a <run-benchmark> element that can be used to run -->
+ <!-- benchmarks -->
+ <!-- It accepts these attributes: -->
+ <!-- count - how many times to run each benchmark (default:3) -->
+ <!-- classname - the name of the class to be ran (default: -->
+ <!-- the name of the ant project -->
+ <!-- logfile - the location of the file where running times -->
+ <!-- are logged (default: ${log.file} property) -->
+ <!-- location - the location of the classfiles: it will end -->
+ <!-- up as head of the current classpath (default: -->
+ <!-- benchmark classes dir/project name -->
+ <macrodef name="run-benchmark">
+ <attribute name="count" default="3"/>
+ <attribute name="classname" default="benchmarks.${ant.project.name}"/>
+ <attribute name="logfile" default="${log.file}"/>
+ <attribute name="location" default="${benchmark.classes.dir}/${ant.project.name}"/>
+
+ <sequential>
+ <echo>** Running benchmark @{classname} in @{location}..</echo>
+ <exec executable="scala" failonerror="true">
+ <arg line="-cp @{location}:${java.class.path}"/>
+ <arg line="@{classname} @{count} @{logfile}"/>
+ </exec>
+ <echo>Done</echo>
+ </sequential>
+ </macrodef>
+
+ <!-- Define a <compile-benchmark> element that can be used to -->
+ <!-- compile benchmarks -->
+ <!-- It accepts these attributes: -->
+ <!-- compiler - the name of the scalac compiler to use. It is -->
+ <!-- useful in case you have multiple compilers -->
+ <!-- installed (default: scalac) -->
+ <!-- additionalArgs - additional arguments to pass to scalac -->
+ <!-- (default: none) -->
+ <!-- destination - the location where class files should be -->
+ <!-- created (default: benchmark classes dir/project -->
+ <!-- name) -->
+ <!-- files - the source files to be compiled -->
+ <macrodef name="compile-benchmark">
+ <attribute name="compiler" default="myscalac"/>
+ <attribute name="additionalArgs" default=""/>
+ <attribute name="destination" default="${benchmark.classes.dir}/${ant.project.name}"/>
+ <attribute name="files"/>
+
+ <sequential>
+ <echo>
+** Building project ${ant.project.name} to @{destination}</echo>
+
+ <exec executable="@{compiler}" failonerror="true">
+ <arg line="-d @{destination}"/>
+ <arg line="@{additionalArgs}"/>
+ <arg line="@{files}"/>
+ </exec>
+ </sequential>
+ </macrodef>
+
+</project> \ No newline at end of file