Commons Email
  1. Commons Email
  2. EMAIL-60

Performance in HtmlEmail#setMsg(String msg)

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.0
    • Fix Version/s: 1.1
    • Labels:
      None

      Description

      The method HtmlEmail.setMsg(String) builds an HTML message from a text message using a StringBuffer. This StringBuffer should be correctly sized according to inputted message, to avoid unnecessary resizing:
      138c138
      < new StringBuffer()

      > new StringBuffer(msg.length() + 37)

      1. HtmlEmail.patch
        1 kB
        Ben Speakmon

        Activity

        Hide
        Henri Yandell added a comment -

        svn ci -m "Applying performance enhancement requested in EMAIL-60"
        Sending src/java/org/apache/commons/mail/HtmlEmail.java
        Transmitting file data .
        Committed revision 501739.

        Show
        Henri Yandell added a comment - svn ci -m "Applying performance enhancement requested in EMAIL-60 " Sending src/java/org/apache/commons/mail/HtmlEmail.java Transmitting file data . Committed revision 501739.
        Hide
        Ben Speakmon added a comment -

        Here's a better patch that calculates the exact size of the StringBuffer. Also, it turns the constant strings into static constants.

        Show
        Ben Speakmon added a comment - Here's a better patch that calculates the exact size of the StringBuffer. Also, it turns the constant strings into static constants.

          People

          • Assignee:
            Unassigned
            Reporter:
            Cédrik LIME
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development