lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler (JIRA)" <>
Subject [jira] Commented: (LUCENE-2547) minimize autoboxing in NumericField
Date Sun, 16 Jan 2011 23:28:44 GMT


Uwe Schindler commented on LUCENE-2547:

I don't like the patch API-wise; my problems are:

- The parameters cannot be null, so at least a null-check is missing
- From the other Numeric* APIs, the object params mean "can be null" (e.g. NumericRangeQuery.newLongRange(...,
Long, Long,...)
- I exposes internal AbstractField details that may be removed in 4.0 with revision of Field
API (see other open issues). We may change the fieldValue protected member in 4.0 (in my opinion,
it should not be at all in AbstractField). So the autoboxing is just needed to fill the Object
fieldValue with *something* (the reason is only stored=true, because fieldValue.toString()
is stored in index - so during indexing more boxing occurs - a cast to String).
- If you try this out with a profiler you see no difference at all (loop creating a field
and setting lots of values) - the objects are shortliving so JRE optimizes (allocates on thread
local heap).

I would like to close this as "won't fix" and don't clutter the API.

> minimize autoboxing in NumericField
> -----------------------------------
>                 Key: LUCENE-2547
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Improvement
>    Affects Versions: 3.0.2
>            Reporter: Woody Anderson
>            Assignee: Simon Willnauer
>             Fix For: 4.0
>         Attachments: LUCENE-2547.patch
> dicIf you already have a Integer/Long/Double etc. numericField.setLongValue(long) causes
an unnecessary auto-unbox.
> actually, since internal to setLongValue there is:
> {code}
> fieldsData = Long.valueOf(value);
> {code}
> then, there is an explicit box anyway, so this makes setLongValue(Long) with an auto-box
of long roughly the same as setLongValue(long), but better if you started with a Long.
> Long being replaceable with Integer, Float, Double etc.

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:
For additional commands, e-mail:

View raw message