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

Michael Sokolov commented on LUCENE-9652:
-----------------------------------------

bq. Ultimately, it would be nice if we could avoid copying the data entirel

Ooh it will be nice to take advantage of the Vector API. I hadn't realized it 
was part of JDK 16; something to look forward to.

I noticed that we did not implement {{ByteBuffersDataInput.readLELongs}}, so 
instead it falls back on the one-at-a-time implementation in {{DataInput}}. I'm 
curious what's the thinking there? I'm not sure how much use this 
{{ByteBuffersDirectory}} gets, but it would probably be nice to offer the bulk 
implementation there too, so I was thinking to add an implementation of 
{{readFloats}} to that, although it's not critical for standard use cases.

> DataInput.readFloats to be used by Lucene90VectorReader
> -------------------------------------------------------
>
>                 Key: LUCENE-9652
>                 URL: https://issues.apache.org/jira/browse/LUCENE-9652
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Michael Sokolov
>            Priority: Major
>
> Benchmarking shows a substantial performance gain can be realized by avoiding 
> the additional memory copy we must do today when converting from {{byte[]}} 
> read using {{IndexInput}} into {{float[]}} returned by 
> {{Lucene90VectorReader}}. We have a model for how to handle the various 
> alignments, and buffer underflow when a value spans buffers, in 
> {{readLELongs}}.
> I think we should only support little-endian floats from the beginning here. 
> We're planning to move towards switching the whole IndexInput to that 
> endianness, right?
> Lucene90VectorWriter relies on {{VectorValues.binaryValue()}} to return bytes 
> in the format expected by the reader, and its javadocs don't currently 
> specify their endianness. In fact the order has been the default supplied by 
> {{ByteBuffer.allocate(int)}}, which I now realize is big-endian, so this 
> issue also proposes to change the index format. That would mean a 
> backwards-incompatible index change, but I think if we're still unreleased 
> and in an experimental class that should be OK?
> Also, we don't need a corresponding {{DataOutput.writeFloats}} to support the 
> current usage for vectors, since there we rely on {{VectorValues}} to do the 
> conversion, so I don't plan to implement that.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to