lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler (Issue Comment Edited) (JIRA)" <j...@apache.org>
Subject [jira] [Issue Comment Edited] (LUCENE-3738) Be consistent about negative vInt/vLong
Date Sun, 18 Mar 2012 19:10:42 GMT

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

Uwe Schindler edited comment on LUCENE-3738 at 3/18/12 7:09 PM:
----------------------------------------------------------------

Patch that fixes all DataInput and DataOutput subclasses to:
- on writeVLong add Mike's assert for positive longs
- unrolled all readVInts and readVLongs
- the readV* methods are now more straightforward implemented at the end of method and do
the same branching and fail at the end with an IOException (last statement)
- I made all read methods in BufferedIndexInput final, as they should be never overridden
(only readInternal/seekInternal). This could improve performance as hotspot knows finalness
better -> inlining.
                
      was (Author: thetaphi):
    Patch that fixes all DataInput and DataOutput subclasses to:
- on writeVInt add Mike's assert for positive longs
- unrolled all readVInts and readVLongs
- the readV* methods are now more straightforward implemented at the end of method and do
the same branching and fail at the end with an IOException (last statement)
- I made all read methods in BufferedIndexInput final, as they should be never overridden
(only readInternal/seekInternal). This could improve performance as hotspot knows finalness
better -> inlining.
                  
> Be consistent about negative vInt/vLong
> ---------------------------------------
>
>                 Key: LUCENE-3738
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3738
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Michael McCandless
>            Assignee: Uwe Schindler
>             Fix For: 3.6, 4.0
>
>         Attachments: LUCENE-3738.patch, LUCENE-3738.patch, LUCENE-3738.patch, LUCENE-3738.patch
>
>
> Today, write/readVInt "allows" a negative int, in that it will encode and decode correctly,
just horribly inefficiently (5 bytes).
> However, read/writeVLong fails (trips an assert).
> I'd prefer that both vInt/vLong trip an assert if you ever try to write a negative number...
it's badly trappy today.  But, unfortunately, we sometimes rely on this... had we had this
assert in 'since the beginning' we could have avoided that.
> So, if we can't add that assert in today, I think we should at least fix readVLong to
handle negative longs... but then you quietly spend 9 bytes (even more trappy!).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


Mime
View raw message