[ http://nagoya.apache.org/jira/browse/XALANJ-1296?page=history ]

Henry Zongaro updated XALANJ-1296:
----------------------------------

      Assign To:     (was: Xalan Developers Mailing List)
           type: Improvement  (was: Bug)
    Description: 
The latest version of DTMManagerDefault.getDTM() checks for a DTM.NULL argument 
*after* catching an ArrayIndexOutOfBoundsException instead of *before*.  The in-
line comment indicates this function is performance critical.  OptimizeIt 
indicates that the performance of the current implementation suffers because of 
the unnecessary creation of ArrayIndexOutOfBoundsException objects.


Instead of

BEGIN CURRENT CODE
-------------------
synchronized public DTM DTMManagerDefault.getDTM(int nodeHandle)
{
  try
  {
    // Performance critical function
    return m_dtms[nodeHandle >>> IDENT_DTM_NODE_BITS];
  }
  catch (java.lang.ArrayIndexOutOfBoundsException e)
  {
    if (nodeHandle == DTM.NULL)
        return null; // Accept as a special case
    else
      throw e; // Programming error; want to know about it
  }
}

----------------
END CURRENT CODE




BEGIN SUGGESTED CODE
-------------------
synchronized public DTM DTMManagerDefault.getDTM(int nodeHandle)
{
  if (nodeHandle == DTM.NULL)
      return null; // Accept as a special case

  // Performance critical function
  return m_dtms[nodeHandle >>> IDENT_DTM_NODE_BITS];
}
----------------
END SUGGESTED CODE

  was:
The latest version of DTMManagerDefault.getDTM() checks for a DTM.NULL argument 
*after* catching an ArrayIndexOutOfBoundsException instead of *before*.  The in-
line comment indicates this function is performance critical.  OptimizeIt 
indicates that the performance of the current implementation suffers because of 
the unnecessary creation of ArrayIndexOutOfBoundsException objects.


Instead of

BEGIN CURRENT CODE
-------------------
synchronized public DTM DTMManagerDefault.getDTM(int nodeHandle)
{
  try
  {
    // Performance critical function
    return m_dtms[nodeHandle >>> IDENT_DTM_NODE_BITS];
  }
  catch (java.lang.ArrayIndexOutOfBoundsException e)
  {
    if (nodeHandle == DTM.NULL)
        return null; // Accept as a special case
    else
      throw e; // Programming error; want to know about it
  }
}

----------------
END CURRENT CODE




BEGIN SUGGESTED CODE
-------------------
synchronized public DTM DTMManagerDefault.getDTM(int nodeHandle)
{
  if (nodeHandle == DTM.NULL)
      return null; // Accept as a special case

  // Performance critical function
  return m_dtms[nodeHandle >>> IDENT_DTM_NODE_BITS];
}
----------------
END SUGGESTED CODE

    Environment: 
Operating System: Linux
Platform: PC

  was:
Operating System: Linux
Platform: PC

       Priority: Major
    Bugzilla Id:   (was: 14522)

> Performance problem due to unnecessary ArrayIndexOutOfBoundsException
> ---------------------------------------------------------------------
>
>          Key: XALANJ-1296
>          URL: http://nagoya.apache.org/jira/browse/XALANJ-1296
>      Project: XalanJ2
>         Type: Improvement
>   Components: DTM
>     Versions: CurrentCVS
>  Environment: Operating System: Linux
> Platform: PC
>     Reporter: Darryl Minard

>
> The latest version of DTMManagerDefault.getDTM() checks for a DTM.NULL 
> argument 
> *after* catching an ArrayIndexOutOfBoundsException instead of *before*.  The 
> in-
> line comment indicates this function is performance critical.  OptimizeIt 
> indicates that the performance of the current implementation suffers because 
> of 
> the unnecessary creation of ArrayIndexOutOfBoundsException objects.
> Instead of
> BEGIN CURRENT CODE
> -------------------
> synchronized public DTM DTMManagerDefault.getDTM(int nodeHandle)
> {
>   try
>   {
>     // Performance critical function
>     return m_dtms[nodeHandle >>> IDENT_DTM_NODE_BITS];
>   }
>   catch (java.lang.ArrayIndexOutOfBoundsException e)
>   {
>     if (nodeHandle == DTM.NULL)
>         return null; // Accept as a special case
>     else
>       throw e; // Programming error; want to know about it
>   }
> }
> ----------------
> END CURRENT CODE
> BEGIN SUGGESTED CODE
> -------------------
> synchronized public DTM DTMManagerDefault.getDTM(int nodeHandle)
> {
>   if (nodeHandle == DTM.NULL)
>       return null; // Accept as a special case
>   // Performance critical function
>   return m_dtms[nodeHandle >>> IDENT_DTM_NODE_BITS];
> }
> ----------------
> END SUGGESTED CODE

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to