[
https://issues.apache.org/jira/browse/SOLR-12725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16618201#comment-16618201
]
Hoss Man commented on SOLR-12725:
---------------------------------
{quote}We might also want to keep track of which pattern last matched for the
field we are currently parsing.
{quote}
I like that idea, but it seems a lot more involved then just re-using a single
ParsePosition repeatedly for a single input string? should probably be it's own
issue?
{quote}Although there is some risk that it's wrong, and it's possible the
formats might be written in a way that is order-dependent, and thus could
produce a different result based on the sequence of document's values.
{quote}
IIUC you seem to be theorizing that by re-using a single ParsePosition, we
might wind up in situations where a parser early in the list leaves the
ParsePosition in a state that causes a parser laterin the list to produce
different results then if it was used on it's own ... that would seem like a
straight up bug to me – if we are going to re-use ParsePosition objects, then
it seems like we should do so _solely_ to avoid the extra object creation –
calling \{setIndex(0)} before every parse call (and checking that the full
string was consumed after every parse call)
> ParseDateFieldUpdateProcessorFactory should reuse ParsePosition
> ---------------------------------------------------------------
>
> Key: SOLR-12725
> URL: https://issues.apache.org/jira/browse/SOLR-12725
> Project: Solr
> Issue Type: Improvement
> Security Level: Public(Default Security Level. Issues are Public)
> Reporter: Andrzej Bialecki
> Assignee: Andrzej Bialecki
> Priority: Minor
>
> {{ParseDateFieldUpdateProcessorFactory.parseInstant}} repeatedly calls all
> configured date parsers ({{DateTimeFormatter}}-s) for each incoming date-like
> field. However, it uses {{DateTimeFormatter.parse(dateStr)}} method that
> needs to allocate a throwaway instance of {{ParsePosition}}, instead of
> {{DateTimeFormatter.parse(dateStr, parsePosition)}}.
> Javadocs for this method suggest reusing (and reseting) a single instance of
> {{ParsePosition}} for multiple calls in order to reduce object allocations.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]