lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Maxim Valyanskiy (Commented) (JIRA)" <>
Subject [jira] [Commented] (SOLR-2679) Optimize memory usage in JavaBinCodec.readStr()
Date Wed, 14 Dec 2011 09:22:30 GMT


Maxim Valyanskiy commented on SOLR-2679:

I think that there is no performance degradation after apply of my patch - I hope that JIT
compiler is smart enough to optimize that method call when we read from stream buffer. I can
make a benchmark if you think that proof is required.

My patch brings other change - it builds character array while reading data from (buffered)
stream so it may be even faster when very large text field is read from network stream. Current
version reads complete text field into byte array and then builds character array.
> Optimize memory usage in JavaBinCodec.readStr()
> -----------------------------------------------
>                 Key: SOLR-2679
>                 URL:
>             Project: Solr
>          Issue Type: Improvement
>          Components: clients - java, Response Writers, update
>    Affects Versions: 3.3
>            Reporter: Maxim Valyanskiy
>             Fix For: 3.6, 4.0
>         Attachments: SOLR-2679.patch
> In Solr 3.3, JavaBinCodec.readStr() reads complete string into byte[] and then converts
it into String. FastInputStream is already buffered, so this it not necessary and may take
a lot of memory if data string is large.
> This patch replaces usage of big byte[] with usage of dis.readUnsignedByte() for getting
characters directly from stream.
> Patch reduces memory usage and may slightly improve performance of reading text data
in javabin-codec.
> JavaBinCodec.readStr() function already has unit test in TestJavaBinCodec, no additional
unit test is required.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message