com.singularsys.jepexamples.diagnostics
Class SpeedTest

java.lang.Object
  extended by com.singularsys.jepexamples.diagnostics.SpeedTest

public class SpeedTest
extends java.lang.Object

Compares the speed of evaluation between different evaluation schemes. The standard class compares BigDecimal, Jep (with default Fast evaluator), the old StandardEvaluator, and RealEvaluator.

If you have some nice complicated examples, I'd love to hear about them to see if we can tune things up. - rich


Nested Class Summary
static class SpeedTest.BDConfig
          Configuration using the BDConfig
static class SpeedTest.EvaluationConfig
          Basic class to set the evaluation context
static class SpeedTest.JepConfig
          Standard Jep configuration (with FastEvaluator)
static class SpeedTest.OldConfig
          Configuration using the StandardEvaluator
static class SpeedTest.Outputter
          Different output methods
static class SpeedTest.RatioOutputter
          Print detailed ratios for each run.
static class SpeedTest.RealConfig
          Configuration using the RealEvaluator
static class SpeedTest.TabOutputter
          Print output tab separated.
 
Field Summary
 int nDeriv
           
 int num_itts
           
 int num_vals
           
protected  SpeedTest.Outputter outputter
           
protected  long[] totalTimes
           
 
Constructor Summary
SpeedTest(SpeedTest.Outputter outputter)
           
 
Method Summary
 void addConfig(SpeedTest.EvaluationConfig config)
          Adds a new EvaluationConfig to be be run for comparison.
 void doAll(java.lang.String[] eqns, java.lang.String[] varNames)
          Run speed comparison for a set of equations.
 void doAll(java.lang.String eqn, java.lang.String[] varNames)
          Run speed comparison for a single equation.
 void fini()
           
static java.lang.String hornerExpression(java.lang.String varName, int nDeriv)
          Generate a string giving an approximation to log using Horner form "x*(1/1-x*(1/2-x*(1/3-x*(1/4 ...))))"
 void init()
           
static java.lang.String lnExpression(java.lang.String varName, int nDeriv)
          Generate string giving approximation to log
static void main(java.lang.String[] args)
          Main method, executes all speed tests.
static void runTests(SpeedTest st)
          A standard set of tests.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

num_itts

public int num_itts

num_vals

public int num_vals

nDeriv

public int nDeriv

outputter

protected SpeedTest.Outputter outputter

totalTimes

protected long[] totalTimes
Constructor Detail

SpeedTest

public SpeedTest(SpeedTest.Outputter outputter)
Parameters:
outputter -
Method Detail

init

public void init()

fini

public void fini()

doAll

public void doAll(java.lang.String eqn,
                  java.lang.String[] varNames)
Run speed comparison for a single equation.

Parameters:
eqn - The equation to test
varNames - an array of variable names which will be set to random values.

doAll

public void doAll(java.lang.String[] eqns,
                  java.lang.String[] varNames)
Run speed comparison for a set of equations.

Parameters:
eqns -
varNames -

addConfig

public void addConfig(SpeedTest.EvaluationConfig config)
Adds a new EvaluationConfig to be be run for comparison.

Parameters:
config -

lnExpression

public static java.lang.String lnExpression(java.lang.String varName,
                                            int nDeriv)
Generate string giving approximation to log


hornerExpression

public static java.lang.String hornerExpression(java.lang.String varName,
                                                int nDeriv)
Generate a string giving an approximation to log using Horner form "x*(1/1-x*(1/2-x*(1/3-x*(1/4 ...))))"


main

public static void main(java.lang.String[] args)
Main method, executes all speed tests.

Parameters:
args -

runTests

public static void runTests(SpeedTest st)
A standard set of tests.

Parameters:
st -


Copyright © 2010 Singular Systems http://www.singularsys.com/jep