This is an automated email from the ASF dual-hosted git repository.
chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fory-site.git
The following commit(s) were added to refs/heads/main by this push:
new f7cc09fba 🔄 synced local 'docs/guide/' with remote 'docs/guide/'
f7cc09fba is described below
commit f7cc09fba9625ef0bb004e4597b901f248962af3
Author: chaokunyang <[email protected]>
AuthorDate: Tue Sep 16 05:08:03 2025 +0000
🔄 synced local 'docs/guide/' with remote 'docs/guide/'
---
docs/guide/java_serialization_guide.md | 43 ++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/docs/guide/java_serialization_guide.md
b/docs/guide/java_serialization_guide.md
index 059668176..e00eb4d7a 100644
--- a/docs/guide/java_serialization_guide.md
+++ b/docs/guide/java_serialization_guide.md
@@ -113,6 +113,8 @@ public class Example {
| `timeRefIgnored` | Whether to ignore reference tracking of all
time types registered in `TimeSerializers` and subclasses of those types when
ref tracking is enabled. If ignored, ref tracking of every time type can be
enabled by invoking `Fory#registerSerializer(Class, Serializer)`. For example,
`fory.registerSerializer(Date.class, new DateSerializer(fory, true))`. Note
that enabling ref tracking should happen before serializer codegen of any types
which contain time fields. [...]
| `compressInt` | Enables or disables int compression for
smaller size.
[...]
| `compressLong` | Enables or disables long compression for
smaller size.
[...]
+| `compressIntArray` | Enables or disables SIMD-accelerated
compression for int arrays when values can fit in smaller data types. Requires
Java 16+.
[...]
+| `compressLongArray` | Enables or disables SIMD-accelerated
compression for long arrays when values can fit in smaller data types. Requires
Java 16+.
[...]
| `compressString` | Enables or disables string compression for
smaller size.
[...]
| `classLoader` | The classloader should not be updated; Fory
caches class metadata. Use `LoaderBinding` or `ThreadSafeFory` for classloader
updates.
[...]
| `compatibleMode` | Type forward/backward compatibility config.
Also Related to `checkClassVersion` config. `SCHEMA_CONSISTENT`: Class schema
must be consistent between serialization peer and deserialization peer.
`COMPATIBLE`: Class schema can be different between serialization peer and
deserialization peer. They can add/delete fields independently. [See
more](#class-inconsistency-and-class-version-check).
[...]
@@ -247,6 +249,47 @@ not worthy compared to performance cost. Maybe you should
try to disable long co
much
space savings.
+### Array Compression
+
+Fory supports SIMD-accelerated compression for primitive arrays (`int[]` and
`long[]`) when array values can fit in smaller data types. This feature is
available on Java 16+ and uses the Vector API for optimal performance.
+
+#### How Array Compression Works
+
+Array compression analyzes arrays to determine if values can be stored using
fewer bytes:
+
+- **`int[]` → `byte[]`**: When all values are in range [-128, 127] (75% size
reduction)
+- **`int[]` → `short[]`**: When all values are in range [-32768, 32767] (50%
size reduction)
+- **`long[]` → `int[]`**: When all values fit in integer range (50% size
reduction)
+
+#### Configuration and Registration
+
+To enable array compression you must explicitly register the serializers:
+
+```java
+Fory fory = Fory.builder()
+ .withLanguage(Language.JAVA)
+ // Enable int array compression
+ .withIntArrayCompressed(true)
+ // Enable long array compression
+ .withLongArrayCompressed(true)
+ .build();
+
+// You must explicitly register compressed array serializers
+CompressedArraySerializers.registerSerializers(fory);
+```
+
+**Note**: The `fory-simd` module must be included in your dependencies for
compressed array serializers to be available.
+
+For Maven:
+
+```xml
+<dependency>
+ <groupId>org.apache.fory</groupId>
+ <artifactId>fory-simd</artifactId>
+ <version>0.13.0-SNAPSHOT</version>
+</dependency>
+```
+
### Object deep copy
Deep copy example:
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]