DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=34113>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=34113


[EMAIL PROTECTED] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #14527|0                           |1
        is obsolete|                            |




------- Additional Comments From [EMAIL PROTECTED]  2005-03-22 02:01 -------
Created an attachment (id=14531)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=14531&action=view)
Slightly more efficient patch - one interation over the list of headers

This patch changes the setValue( ) method call to an addValue( ) method call to
avoid needlessly iterating over the entire list in the call to setValue(
)--since setValue( ) will not find a header with given name after all headers
with that name have been removed.

After this patch, a call to setHeader( ) will require one full iteration
through the list of headers; whereas current CVS iterates over half the list,
on average, inside the call to setValue( ).  Therefore, assuming the
DEFAULT_HEADER_SIZE of 8, this will mean an additional 4 String comparisons,
but without using a hash or some kind of custom search tree or redesigning
MimeHeaders with multiple header values in mind, a full iteration over the list
is unavoidable.  So, are the additional String comparisons a small enough price
to pay for compliance?  :)

A better solution is to fix the setValue( ) method of the MimeHeaders
class--assuming (since the partial javadoc doesn't say so) that setValue( )
should replace all existing headers having the given name.  If this is the
intended behavior of the setValue( ) method, the next patch could be used
instead.  It's consequences (and implementation) are identical to those of this
patch.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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

Reply via email to