It was taking about 60 ms to scan a 1000
messages with a selector containing a
regular expression (with JDK 1.3.1...
it was far worse with earlier JVMs).
It turns out the code was recompiling
the RE on every message tested. In
addition to adding time overhead this
probably produces lots of garbage.
The patch changes the Operator class
to retain the results of the RE compilation
done the first time the selector is
evaluated. (It might be more logical
to compile the RE when the selector
is parsed, but that change would be
a bit more complicated to make).
The RE wrapper code (which wraps the
gnu regexp code) was moved into a
separate class for clarity.
Some other small changes were
made to improve performance
and clarity.
End result is a 2X speed-up
(from 60ms/1000msg to 30/1000)
tar file relative to jboss-all directory
Logged In: YES
user_id=15045
Sounds reasonable. Looked over the patch and ran
testsuite and all looks ok. Perhaps you can also provide
a stress/perf test for this?
--jason