You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Michael McCandless (JIRA)" <ji...@apache.org> on 2009/01/08 16:14:59 UTC

[jira] Commented: (LUCENE-1497) Minor changes to SimpleHTMLFormatter

    [ 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-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org