问题
I found that using the query methods “PropertyGreaterThanEquals” or "PropertyLessThanEquals" runs very much slower than using the method “PropertyEquals”. below is a simple example about query a suitable dock for truck to unload goods.
public void match_dock() {
// Query<Object> pre_fit = new PropertyGreaterThanEquals(context, "unload_speed", 240);
// Query<Object> pre_fit = new PropertyLessThanEquals(context, "unload_speed", 240);
Query<Object> pre_fit = new PropertyEquals(context, "unload_speed", 240);
for (Object o : pre_fit.query()) {
if (o instanceof Dock) {
System.out.println("this dock's id is: " + ((Dock)o).getId());
}
}
}
There are only 3 docks. it took me less than one second to run total of 1920 ticks if using "PropertyEquals"; however, it took me more than 1 minute to run total of 1920 ticks if choosing the query methods “PropertyGreaterThanEquals” or "PropertyLessThanEquals". what's the underlying cause of this slow execution problem?
来源:https://stackoverflow.com/questions/61606900/repast-propertygreaterthanequals-propertylessthanequals-cause-slow-running-spe