@@ -0,0 +1,3036 @@
+/*%0A *  Copyright (C) 2011-2012 The Animo Project%0A *  http://animotron.org%0A *  %09%0A *  This file is part of Animotron.%0A *  %0A *  Animotron is free software: you can redistribute it and/or modify%0A *  it under the terms of the GNU Affero General Public License as %0A *  published by the Free Software Foundation, either version 3 of %0A *  the License, or (at your option) any later version.%0A *  %0A *  Animotron is distributed in the hope that it will be useful,%0A *  but WITHOUT ANY WARRANTY; without even the implied warranty of%0A *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A *  GNU Affero General Public License for more details.%0A *  %0A *  You should have received a copy of %0A *  the GNU Affero General Public License along with Animotron.  %0A *  If not, see %3Chttp://www.gnu.org/licenses/%3E.%0A */%0Apackage org.animotron.statement.math;%0A%0Aimport org.animotron.ATest;%0Aimport org.animotron.expression.AbstractExpression;%0Aimport org.animotron.expression.AnimoExpression;%0Aimport org.animotron.expression.Expression;%0Aimport org.animotron.expression.JExpression;%0Aimport org.animotron.graph.builder.FastGraphBuilder;%0Aimport org.animotron.statement.operator.AN;%0Aimport org.animotron.statement.operator.REF;%0Aimport org.animotron.statement.operator.THE;%0Aimport org.junit.Test;%0Aimport org.neo4j.graphdb.Relationship;%0A%0Aimport static java.lang.System.currentTimeMillis;%0Aimport static org.animotron.expression.Expression.__;%0Aimport static org.animotron.expression.JExpression._;%0Aimport static org.animotron.expression.JExpression.value;%0A%0A/**%0A * @author %3Ca href=%22mailto:gazdovsky@gmail.com%22%3EEvgeny Gazdovsky%3C/a%3E%0A *%0A */%0Apublic class SUM500Test extends ATest %7B%0A%0A%09@Test%0A%09public void test_00() throws Throwable %7B%0A        long t;%0A        t = currentTimeMillis();%0A        Relationship e = __(new AbstractExpression(new FastGraphBuilder()) %7B%0A            @Override%0A            public void build() throws Throwable %7B%0A                builder.start(AN._);%0A                builder._(REF._, SUM._.name());%0A                for (int i = 0; i %3C 500; i++) %7B%0A                    builder._(i);%0A                %7D%0A                builder.end();%0A            %7D%0A        %7D);%0A        System.out.println(%22Build expression in %22 + (currentTimeMillis() - t));%0A        t = currentTimeMillis();%0A        assertAnimoResult(e, %22124750%22);%0A        System.out.println(%22Eval expression in %22 + (currentTimeMillis() - t));%0A%09%7D%0A%0A%09@Test%0A%09public void test_01() throws Throwable %7B%0A        long t;%0A        t = currentTimeMillis();%0A        for (int i = 0; i %3C 500; i++) %7B%0A            __(new JExpression(%0A                    _(THE._, %22a%22 + i, %0A                            _(AN._, %22a%22),%0A                            _(AN._, %22value%22, value(i))%0A                    )%0A            ));%0A        %7D%0A        Expression e = new AnimoExpression(%22summ get value all a%22);%0A        System.out.println(%22Build expressions in %22 + (currentTimeMillis() - t));%0A        t = currentTimeMillis();%0A        assertAnimoResult(e, %22124750%22);%0A        System.out.println(%22Eval expression in %22 + (currentTimeMillis() - t));%0A%09%7D%0A%0A%7D

sum 500 items