-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fast-avro] Added a few serde optimization #517
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff, thanks Gaojie! Left just a few minor comments...
...sts-common/src/test/java/com/linkedin/avro/fastserde/FastGenericSerializerGeneratorTest.java
Outdated
Show resolved
Hide resolved
...avro-fastserde/src/main/java/com/linkedin/avro/fastserde/BufferBackedPrimitiveFloatList.java
Outdated
Show resolved
Hide resolved
...ro-fastserde/src/main/java11/com/linkedin/avro/fastserde/BufferBackedPrimitiveFloatList.java
Outdated
Show resolved
Hide resolved
...ro-fastserde/src/main/java11/com/linkedin/avro/fastserde/BufferBackedPrimitiveFloatList.java
Show resolved
Hide resolved
Should we wait until we finish benchmarking deserialization path? |
Why wait? We can always submit another PR if we discover other opportunities, right? |
Serializer: This code change will try to reuse the backed bytes if the float list is 'BufferBackedPrimitiveFloatList' when writing float list. If an instance of `BufferBackedPrimitiveFloatList` is changed after deserialization: `readPrimitiveFloatArray`, Fast Serializer won't use the backed bytes because of the divergence. Deserializer: Use `reset` instead of `clear` when reusing `GenericArray` since `reset` is cheaper than `clear` and the behavior difference is that `reset` won't nullify the elements in current array, but just resize the array length to be 0.
aa05e8f
to
1f3c648
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks!
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #517 +/- ##
============================================
+ Coverage 45.77% 45.78% +0.01%
- Complexity 4438 4442 +4
============================================
Files 403 403
Lines 28070 28070
Branches 4622 4622
============================================
+ Hits 12850 12853 +3
Misses 13664 13664
+ Partials 1556 1553 -3 ☔ View full report in Codecov by Sentry. |
Serializer:
This code change will try to reuse the backed bytes if the float list is 'BufferBackedPrimitiveFloatList' when writing float list. If an instance of
BufferBackedPrimitiveFloatList
is changed after deserialization:readPrimitiveFloatArray
, Fast Serializer won't use the backed bytes because of the divergence.Deserializer:
Use
reset
instead ofclear
when reusingGenericArray
sincereset
is cheaper thanclear
and the behavior difference is thatreset
won't nullify the elements in current array, but just resize the array length to be 0.