Pigsy-Monk opened a new pull request, #3124:
URL: https://github.com/apache/fory/pull/3124

   
   
   ## Why?
   
   This PR adds variable-length encoding support for `int[]` arrays, which 
provides space savings when arrays contain many small values. This is 
particularly beneficial for use cases like sparse arrays, indices, counters, 
and other scenarios where array values are predominantly small integers.
   
   ## What does this PR do?
   
   ### Changes:
   
   1. **Enhanced `IntArraySerializer` with variable-length encoding**:
      - Added `writeInt32s()` method that uses `writeVarUint32()` for each 
element
      - Added `readInt32s()` method that uses `readVarInt32()` for each element
      - Enabled via `compressIntArray()` configuration flag
   
   3. **Added comprehensive test cases**:
      - `testVariableLengthIntArray()`: Tests serialization/deserialization 
correctness for int arrays
      - `testVariableLengthIntArrayEncodingEfficiencyForSmallValues()`: 
Demonstrates space efficiency for int arrays
   
   ### Technical Details:
   
   - **IntArraySerializer**: Uses `writeVarUint32()` / `readVarInt32()` for 
variable-length encoding
   - Compression is only enabled when:
     - `compressIntArray()` is `true`
   
   ### Space Efficiency:
   
   - **Int arrays with small values (0-127)**:
     - Fixed-length: 4 bytes/element
     - Variable-length: 1-2 bytes/element


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to