[ 
https://issues.apache.org/jira/browse/LUCENE-1497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12661992#action_12661992
 ] 

Michael McCandless commented on LUCENE-1497:
--------------------------------------------

In fact I think it may be faster to not even use StringBuffer in highlightTerm? 
 Since we know we are concatenating 3 strings can we just + them?  I suspect 
that'd give better net performance (pure speculation!).

> Minor changes to SimpleHTMLFormatter
> ------------------------------------
>
>                 Key: LUCENE-1497
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1497
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: contrib/highlighter
>            Reporter: Shai Erera
>            Priority: Minor
>             Fix For: 2.4.1, 2.9
>
>         Attachments: LUCENE-1497.patch
>
>
> I'd like to make few minor changes to SimpleHTMLFormatter.
> 1. Define DEFAULT_PRE_TAG and DEFAULT_POST_TAG and use them in the default 
> constructor. This will not trigger String lookups by the JVM whenever the 
> highlighter is instantiated.
> 2. Create the StringBuffer in highlightTerm with the right number of 
> characters from the beginning. Even though StringBuffer's default constructor 
> allocates 16 chars, which will probably be enough for most highlighted terms 
> (pre + post tags are 7 chars, which leaves 9 chars for terms), I think it's 
> better to allocate SB with the right # of chars in advance, to avoid char[] 
> allocations in the middle.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-dev-h...@lucene.apache.org

Reply via email to