JESS: Which is faster?
"Donald Winston" <[email protected]>
| Newsgroups | gmane.comp.java.jess |
|---|---|
| Message-ID | <831_1282052015_o7HDV1B2001097_22C14136-0069-4B54-AF00-02C9A87BAF42@yahoo.com> |
Is there enough of a difference in performance between the following to worry about?
; from Jess
(assert (param-name1 ?param-value1))
(assert (param-name2 ?param-value2))
(assert (param-name3 ?param-value3a ?param-value3b ?param-value3c))
...,etc
v.s.
/* Assert ordered facts from the request parameter map.
* No deftemplate is necessary (I have an unorderd fact version of this too) */
private void assertRequestParameters(HttpServletRequest request) throws JessException {
Map map = request.getParameterMap();
Iterator keys = map.keySet().iterator();
while (keys.hasNext() == true) {
String key = (String)keys.next();
Fact fact = new Fact(key, peerEngine);
String[] paramValues = (String[])map.get(key);
ValueVector values = new ValueVector();
for(String value : paramValues)
values.add(new Value(value, RU.STRING));
fact.setSlotValue("_data", new Value(values, RU.LIST));
peerEngine.assertFact(fact);
}
}