[
https://issues.apache.org/jira/browse/AVRO-1282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13636985#comment-13636985
]
Doug Cutting commented on AVRO-1282:
------------------------------------
There was a '==========' in the patch that I had to remove to get it to
compile, and a print statement I removed.
Here are the results I see with the latest patch:
Before:
{code}
test name time M entries/sec M bytes/sec
bytes/cycle
ReflectArrayRead: 23522 ms 8.503 34.011 1000006
ReflectArrayWrite: 18698 ms 10.696 42.785 1000006
ReflectSmallFloatArrayRead: 58845 ms 3.399 15.294 1125004
ReflectSmallFloatArrayWrite: 29458 ms 6.789 30.551 1125004
ReflectMediumFloatArrayRead: 22690 ms 8.814 35.610 1010003
ReflectMediumFloatArrayWrite: 19735 ms 10.134 40.941 1010003
ReflectRecordRead: 46990 ms 0.709 43.536 2557239
ReflectRecordWrite: 42195 ms 0.790 48.483 2557239
{code}
After:
{code}
test name time M entries/sec M bytes/sec
bytes/cycle
ReflectArrayRead: 9099 ms 21.978 87.913 1000006
ReflectArrayWrite: 3677 ms 54.388 217.552 1000006
ReflectSmallFloatArrayRead: 20353 ms 9.826 44.219 1125004
ReflectSmallFloatArrayWrite: 10164 ms 19.676 88.541 1125004
ReflectMediumFloatArrayRead: 7869 ms 25.414 102.672 1010003
ReflectMediumFloatArrayWrite: 4719 ms 42.379 171.213 1010003
ReflectRecordRead: 14973 ms 2.226 136.629 2557239
ReflectRecordWrite: 11479 ms 2.904 178.218 2557239
{code}
In general, around a 3x speedup. Nice!
(This is Java 7 on my laptop, 64-bit Linux.)
> Make use of the sun.misc.Unsafe class during serialization if a JDK supports
> it
> -------------------------------------------------------------------------------
>
> Key: AVRO-1282
> URL: https://issues.apache.org/jira/browse/AVRO-1282
> Project: Avro
> Issue Type: Improvement
> Components: java
> Affects Versions: 1.7.4
> Reporter: Leo Romanoff
> Priority: Minor
> Attachments: avro-1282-v1.patch, avro-1282-v2.patch,
> avro-1282-v3.patch, avro-1282-v4.patch, avro-1282-v5.patch, avro-1282-v6.patch
>
>
> Unsafe can be used to significantly speed up serialization process, if a JDK
> implementation supports java.misc.Unsafe properly. Most JDKs running on PCs
> support it. Some platforms like Android lack a proper support for Unsafe yet.
> There are two possibilities to use Unsafe for serialization:
> 1) Very quick access to the fields of objects. It is way faster than with the
> reflection-based approach using Field.get/set
> 2) Input and Output streams can be using Unsafe to perform very quick
> input/output.
>
> 3) More over, Unsafe makes it possible to serialize to/deserialize from
> off-heap memory directly and very quickly, without any intermediate buffers
> allocated on heap. There is virtually no overhead compared to the usual byte
> arrays.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira