[ 
https://issues.apache.org/jira/browse/LUCY-39?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12753398#action_12753398
 ] 

Marvin Humphrey commented on LUCY-39:
-------------------------------------

NumberUtils provides three kinds of functions:

   * Encoding and decoding of big-endian numbers.
   * Encoding and decoding of compressed integers.
   * Sub-byte array manipulation, e.g. NumUtil_u2set, NumUtil_u2get for
     interpreting a block of bytes as an array of two-bit integers.

All functions are published as static inline for maximum speed.

The sub-byte array manipulation functions do not perform any bounds checking;
that responsibility is left for the caller.  In some cases, it is possible
to guarantee safety without a check per lookup.

The compressed integer functions encode and decode "C32" and "C64" types.
These differ from Lucene's VInts in the order in which the bytes are packed,
and have two advantages. First, as Yonik [pointed 
out|http://mail-archives.apache.org/mod_mbox/lucene-java-dev/200605.mbox/%[email protected]%3e]
a while back...

> The decoding could be slightly faster with reverse-byte order since you
> don't have to maintain a shift-count:

Second, they can be padded with [leading 
zeroes|http://mail-archives.apache.org/mod_mbox/lucene-java-dev/200605.mbox/%[email protected]%3e].

Posting list decoders in particular will use the NumberUtils functions to
operate directly on memory mapped files whenever possible, avoiding both
function call and virtual method dispatch overhead.


> NumberUtils
> -----------
>
>                 Key: LUCY-39
>                 URL: https://issues.apache.org/jira/browse/LUCY-39
>             Project: Lucy
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Marvin Humphrey
>            Assignee: Marvin Humphrey
>
> Add the Lucy::Util::NumberUtils module, which provides highly optimized static
> inline functions for manipulating big-endian numbers, sub-byte arrays, and
> compressed integers.

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

Reply via email to