This is definately a minor point and probably not something to worry about
until later when performance tuning comes more to the foreground, but
I'm seeing a lot of code that uses 'instanceof' which I think is not very efficient.
For example, rather than say (arg2 instanceof String) I think that
(arg2.getClass() == String.class) is more efficient. The same can be done
for Integer.class, Float.class, Long.class, etc.

Now for sure you can't always avoid the use of instanceof,
ie., when class widening or narrowing needs to be considered, but in the selector
parse code, there may be some opprotunities to use the class contants.

Just a thought -- (for the purpose of a great SpyderMQ)

jBoss CVS Development wrote:

>   User: norbert
>   Date: 00/05/22 09:18:42
>
>   Modified:    src/java/org/spyderMQ/selectors Operator.java parserval.java
>   Log:
>   Fix for selectors
>
>   Revision  Changes    Path
>   1.5       +2 -2      spyderMQ/src/java/org/spyderMQ/selectors/Operator.java
>
>   Index: Operator.java
>   ===================================================================
>   RCS file: 
>/products/cvs/ejboss/spyderMQ/src/java/org/spyderMQ/selectors/Operator.java,v
>   retrieving revision 1.4
>   retrieving revision 1.5
>   diff -u -r1.4 -r1.5
>   --- Operator.java     2000/05/20 02:34:01     1.4
>   +++ Operator.java     2000/05/22 16:18:41     1.5
>   @@ -11,7 +11,7 @@
>     *
>     *   @author Norbert Lataille ([EMAIL PROTECTED])
>     *
>   - *   @version $Revision: 1.4 $
>   + *   @version $Revision: 1.5 $
>     */
>    public class Operator
>    {
>   @@ -123,7 +123,7 @@
>                 if (arg1 instanceof String) {
>                         Object arg2=computeArgument(oper2);
>                         if (arg2==null) return Boolean.FALSE;
>   -                     if (!(arg2 instanceof String)) throw new 
>Exception("EQUAL:Bad object type");
>   +                     if (!(arg2 instanceof String)) throw new Exception("EQUAL: 
>Bad object type");
>                         return new Boolean(arg1.equals(arg2));
>                 }
>
>
>
>
>   1.4       +1 -1      spyderMQ/src/java/org/spyderMQ/selectors/parserval.java
>
>   Index: parserval.java
>   ===================================================================
>   RCS file: 
>/products/cvs/ejboss/spyderMQ/src/java/org/spyderMQ/selectors/parserval.java,v
>   retrieving revision 1.3
>   retrieving revision 1.4
>   diff -u -r1.3 -r1.4
>   --- parserval.java    2000/05/20 02:12:18     1.3
>   +++ parserval.java    2000/05/22 16:18:41     1.4
>   @@ -1,4 +1,4 @@
>   -
>   +package org.spydermq.selectors;
>
>    //########## SEMANTIC VALUES ##########
>    public class parserval
>
>
>


Reply via email to