apache / fury

A blazingly fast multi-language serialization framework powered by JIT and zero-copy.
https://fury.apache.org/
Apache License 2.0
3.11k stars 248 forks source link

feat(java): reduce metastring hashcode payload for small string(<=16 bytes) #1909

Closed chaokunyang closed 3 weeks ago

chaokunyang commented 3 weeks ago

What does this PR do?

If a meta string is less than 16 bytes, we skip write hashcode to reduce space cost. This will bring a big gain since most metastring-encoded ClassName/EnumName are less than 16 bytes . And package names are much less compared to classname, thus can save space by dict encoding sharing.

Does this PR introduce any user-facing change?

Benchmark

// old size 391
// Benchmark                                  (bufferType)   (objectType)  (references)   Mode  Cnt        Score       Error  Units
// UserTypeDeserializeSuite.fury_deserialize         array  MEDIA_CONTENT         false  thrpt  100  2751601.402 ± 28811.825  ops/s

// new size: 377
// Benchmark                                  (bufferType)   (objectType)  (references)   Mode  Cnt        Score       Error  Units
// UserTypeDeserializeSuite.fury_deserialize         array  MEDIA_CONTENT         false  thrpt  100  2748329.241 ± 28163.821  ops/s