Repeatedly creating this ArrayList is bound to be O(n2).

Why do you want the Post facts as a List? There may be better ways for
achieving your goal.

-W


On 13 February 2012 20:49, Shur, Bob <robert.s...@hp.com> wrote:

> I have a simple class Post { int id; ... }. I insert some number of them
> as facts and then call ksession.execute(facts);
>
> The whole drl file (except for package and import statements) is:
>
> rule "collect"
> when
>        $a : ArrayList(size > 0) from collect(Post());
> then
>        System.out.println("Number of posts: " + $a.size());
>        System.out.println("DONE");
> end
>
> The time it takes to run is n-squared in the number of posts. For 4000,
> 8000, 16000, 32000, 64000 posts the time is (in 1/10 seconds):
>
> 4, 14, 56, 220, 852
>
> Is this expected? Is there a better way for me to do the collect?
>
>
> _______________________________________________
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to