private void runGBDT(int iterations, String gbdtString) throws ParseException {

        // Unoptimized...............
        double total = benchmark(new RankingExpression(gbdtString), new MapContext(), iterations, "Unoptimized");
        System.out.println("-----------------------------------------------------------------------------------------------------");

        // Tree optimized...................
        RankingExpression treeOptimized = new RankingExpression(gbdtString);
        ArrayContext treeContext = new ArrayContext(treeOptimized, true);
        ExpressionOptimizer optimizer = new ExpressionOptimizer();
        optimizer.getOptimizer(GBDTForestOptimizer.class).setEnabled(false);
        System.out.print("Tree optimizing ... ");
        OptimizationReport treeOptimizationReport = optimizer.optimize(treeOptimized, treeContext);
        System.out.println("done");
        System.out.println(treeOptimizationReport);
        double treeTotal = benchmark(treeOptimized, treeContext, iterations, "Tree optimized");
        assertEqualish(total, treeTotal);
        System.out.println("-----------------------------------------------------------------------------------------------------");

        // Forest optimized...................
        RankingExpression forestOptimized=new RankingExpression(gbdtString);
        DoubleOnlyArrayContext forestContext = new DoubleOnlyArrayContext(forestOptimized, true);
        System.out.print("Forest optimizing ... ");
        OptimizationReport forestOptimizationReport=new ExpressionOptimizer().optimize(forestOptimized, forestContext);
        System.out.println("done");
        System.out.println(forestOptimizationReport);
        double forestTotal=benchmark(forestOptimized,forestContext,iterations,"Forest optimized");
        assertEqualish(total,forestTotal);
        System.out.println("-----------------------------------------------------------------------------------------------------");
    }
Two small benchmarks of ranking expression evaluation

@author bratseth
searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/EvaluationBenchmark.java