Re: JESS: Which is faster?

"Friedman-Hill, Ernest" <[email protected]>
Newsgroups gmane.comp.java.jess
Message-ID <12193_1282058569_o7HFMMZj015406_EDF23F4598F86548AC2974724DF6C2EA1D67A25E2F@ES02SNLNT.srn.sandia.gov>
No, just the small overhead of parsing.


From: Donald Winston [mailto:[email protected]]
Sent: Tuesday, August 17, 2010 07:08 AM
To: jess-users
Subject: JESS: Which is faster?

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);
}
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.