Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
8abeba5
update spec doc
chaokunyang Jan 5, 2026
0f08ce4
update buffer read/write API
chaokunyang Jan 5, 2026
d0eed13
rename _util to buffer
chaokunyang Jan 5, 2026
a9701f7
rename _registry to registry
chaokunyang Jan 5, 2026
ea6401e
support unsigned types and refactor java type system
chaokunyang Jan 6, 2026
d59b477
fix errors
chaokunyang Jan 7, 2026
f95614f
refactor xlang numeric read/write
chaokunyang Jan 7, 2026
68512fc
fix rust error
chaokunyang Jan 7, 2026
cd34fac
fix go unsigned support
chaokunyang Jan 7, 2026
b870947
fix go codegen
chaokunyang Jan 7, 2026
cfc927b
update c++ unsigned and compressed int support
chaokunyang Jan 7, 2026
e663c1b
support unsigned and configurable compress types for field
chaokunyang Jan 7, 2026
852d92c
add javadoc to annotation
chaokunyang Jan 7, 2026
51688b0
add unsgined fields xlang tests
chaokunyang Jan 7, 2026
f2f5059
revert build_linux_wheels.py
chaokunyang Jan 7, 2026
43b7783
add unsigned java tests
chaokunyang Jan 7, 2026
baf70d7
fix descriptor sort comparator
chaokunyang Jan 7, 2026
4d16d37
fix go/java xlang struct fields serde
chaokunyang Jan 8, 2026
4b225ba
refactor go struct serializer
chaokunyang Jan 9, 2026
145adaa
support unsigned in python
chaokunyang Jan 10, 2026
51e6848
add rust unsigned and compressed fields support
chaokunyang Jan 10, 2026
098117b
update xlang tests in java side
chaokunyang Jan 10, 2026
1c5670b
make cpp support configure number encoding and sort fields for all nu…
chaokunyang Jan 10, 2026
67758cf
refactor rust field meta config parse
chaokunyang Jan 10, 2026
aaa66e8
update go test
chaokunyang Jan 10, 2026
9ed0723
format code
chaokunyang Jan 10, 2026
2f25afa
Merge remote-tracking branch 'asf/main' into support_unsigned_types_f…
chaokunyang Jan 10, 2026
1bd9fe1
fix merge conflict
chaokunyang Jan 10, 2026
268fd95
fix tests
chaokunyang Jan 10, 2026
b3a9723
fix python tests
chaokunyang Jan 10, 2026
ad0257e
fix c++ tests
chaokunyang Jan 10, 2026
eb99c8c
fix go tests
chaokunyang Jan 10, 2026
df96ffd
revert DEBUG_OUTPUT_ENABLED flag
chaokunyang Jan 10, 2026
b05ac57
fix tests
chaokunyang Jan 10, 2026
c012fee
update cpp doc for fields
chaokunyang Jan 10, 2026
4f7fbad
update go tag
chaokunyang Jan 10, 2026
88a0194
fix: add license header and fix type conversion in DefaultValueUtils
chaokunyang Jan 10, 2026
3247510
fix: push stub ref id when global ref tracking is enabled but field t…
chaokunyang Jan 10, 2026
cca95fb
fix ci
chaokunyang Jan 10, 2026
fe0fb76
style: format code with spotless
chaokunyang Jan 10, 2026
72802ac
fix: use Types.getTypeId for Scala/Kotlin default value type dispatch
chaokunyang Jan 10, 2026
47169d8
fix build ci
chaokunyang Jan 10, 2026
db73589
fix(ci): correct buffer.go typo to buffer.so in macos universal2 build
chaokunyang Jan 10, 2026
585e545
udpate benchmark code
chaokunyang Jan 10, 2026
64482b5
fix code style
chaokunyang Jan 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build-native-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ jobs:
X86_DIR=$(ls -d unpacked/x86_64/pyfory-*)
UNIVERSAL_DIR="unpacked/pyfory-universal2"
cp -R "$ARM_DIR" "$UNIVERSAL_DIR"
for so in pyfory/_util.so pyfory/serialization.so pyfory/format/_format.so pyfory/lib/mmh3/mmh3.so; do
for so in pyfory/buffer.so pyfory/serialization.so pyfory/format/_format.so pyfory/lib/mmh3/mmh3.so; do
lipo -create "$ARM_DIR/$so" "$X86_DIR/$so" -output "$UNIVERSAL_DIR/$so"
done
WHEEL_FILE=$(ls "$UNIVERSAL_DIR"/pyfory-*.dist-info/WHEEL)
Expand All @@ -187,7 +187,7 @@ jobs:
VERIFY_DIR=$(ls -d verify/pyfory-*)
WHEEL_FILE=$(ls "$VERIFY_DIR"/pyfory-*.dist-info/WHEEL)
grep -q "macosx_11_0_universal2" "$WHEEL_FILE"
for so in pyfory/_util.so pyfory/serialization.so pyfory/format/_format.so pyfory/lib/mmh3/mmh3.so; do
for so in pyfory/buffer.so pyfory/serialization.so pyfory/format/_format.so pyfory/lib/mmh3/mmh3.so; do
echo "$so: $(lipo -archs "$VERIFY_DIR/$so")"
done
- name: Upload universal2 wheel
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-native-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ jobs:
X86_DIR=$(ls -d unpacked/x86_64/pyfory-*)
UNIVERSAL_DIR="unpacked/pyfory-universal2"
cp -R "$ARM_DIR" "$UNIVERSAL_DIR"
for so in pyfory/_util.so pyfory/serialization.so pyfory/format/_format.so pyfory/lib/mmh3/mmh3.so; do
for so in pyfory/buffer.so pyfory/serialization.so pyfory/format/_format.so pyfory/lib/mmh3/mmh3.so; do
lipo -create "$ARM_DIR/$so" "$X86_DIR/$so" -output "$UNIVERSAL_DIR/$so"
done
WHEEL_FILE=$(ls "$UNIVERSAL_DIR"/pyfory-*.dist-info/WHEEL)
Expand All @@ -225,7 +225,7 @@ jobs:
VERIFY_DIR=$(ls -d verify/pyfory-*)
WHEEL_FILE=$(ls "$VERIFY_DIR"/pyfory-*.dist-info/WHEEL)
grep -q "macosx_11_0_universal2" "$WHEEL_FILE"
for so in pyfory/_util.so pyfory/serialization.so pyfory/format/_format.so pyfory/lib/mmh3/mmh3.so; do
for so in pyfory/ pyfory/serialization.so pyfory/format/_format.so pyfory/lib/mmh3/mmh3.so; do
echo "$so: $(lipo -archs "$VERIFY_DIR/$so")"
done
- name: Upload universal2 wheel
Expand Down
9 changes: 5 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ While working on Fory, please remember:
- **Git-Tracked Files**: When reading code, skip all files not tracked by git by default unless generated by yourself.
- **Cross-Language Consistency**: Maintain consistency across language implementations while respecting language-specific idioms.
- **Graalvm Support using fory codegen**: For graalvm, please use `fory codegen` to generate the serializer when building graalvm native image, do not use graallvm reflect-related configuration unless for JDK `proxy`.
- **Xlang Type System**: Java `native mode(xlang=false)` shares same type systems between type id from `Types.BOOL~Types.STRING` with `xlang mode(xlang=true)`, but for other types, java `native mode` has different type ids.

## Build and Development Commands

Expand Down Expand Up @@ -125,7 +126,7 @@ cd java
mvn -T16 install -DskipTests
cd fory-core
# disable fory cython for faster debugging
FORY_PYTHON_JAVA_CI=1 ENABLE_FORY_CYTHON_SERIALIZATION=0 mvn -T16 test -Dtest=org.apache.fory.xlang.PythonXlangTest
FORY_PYTHON_JAVA_CI=1 ENABLE_FORY_CYTHON_SERIALIZATION=0 ENABLE_FORY_DEBUG_OUTPUT=1 mvn -T16 test -Dtest=org.apache.fory.xlang.PythonXlangTest
# enable fory cython
FORY_PYTHON_JAVA_CI=1 ENABLE_FORY_CYTHON_SERIALIZATION=1 ENABLE_FORY_DEBUG_OUTPUT=1 mvn -T16 test -Dtest=org.apache.fory.xlang.PythonXlangTest
```
Expand Down Expand Up @@ -215,7 +216,7 @@ Run Rust xlang tests:
cd java
mvn -T16 install -DskipTests
cd fory-core
FORY_RUST_JAVA_CI=1 ENABLE_FORY_DEBUG_OUTPUT=1 mvn test -Dtest=org.apache.fory.xlang.RustXlangTest
RUST_BACKTRACE=1 FORY_PANIC_ON_ERROR=1 FORY_RUST_JAVA_CI=1 ENABLE_FORY_DEBUG_OUTPUT=1 mvn test -Dtest=org.apache.fory.xlang.RustXlangTest
```

### JavaScript/TypeScript Development
Expand Down Expand Up @@ -445,12 +446,12 @@ Code structure:

- `python/pyfory/serialization.pyx`: Core serialization logic and entry point for cython mode based on `xlang serialization format`
- `python/pyfory/_fory.py`: Serialization entry point for pure python mode based on `xlang serialization format`
- `python/pyfory/_registry.py`: Type registry, resolution and serializer dispatch for pure python mode, which is also used by cython mode. Cython mode use a cache to reduce invocations to this module.
- `python/pyfory/registry.py`: Type registry, resolution and serializer dispatch for pure python mode, which is also used by cython mode. Cython mode use a cache to reduce invocations to this module.
- `python/pyfory/serializer.py`: Serializers for non-internal types
- `python/pyfory/includes`: Cython headers for `c++` functions and classes.
- `python/pyfory/resolver.py`: resolving shared/circular references when ref tracking is enabled in pure python mode
- `python/pyfory/format`: Fory row format encoding and decoding, arrow columnar format interoperation
- `python/pyfory/_util.pyx`: Buffer for reading/writing data, string utilities. Used by `serialization.pyx` and `python/pyfory/format` at the same time.
- `python/pyfory/buffer.pyx`: Buffer for reading/writing data, string utilities. Used by `serialization.pyx` and `python/pyfory/format` at the same time.

#### Go

Expand Down
18 changes: 9 additions & 9 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ load("@hedron_compile_commands//:refresh_compile_commands.bzl", "refresh_compile


pyx_library(
name = "_util",
name = "buffer",
srcs = glob([
"python/pyfory/includes/*.pxd",
"python/pyfory/_util.pxd",
"python/pyfory/_util.pyx",
"python/pyfory/buffer.pxd",
"python/pyfory/buffer.pyx",
"python/pyfory/__init__.py",
]),
cc_kwargs = dict(
Expand Down Expand Up @@ -54,7 +54,7 @@ pyx_library(
name = "serialization",
srcs = glob([
"python/pyfory/includes/*.pxd",
"python/pyfory/_util.pxd",
"python/pyfory/buffer.pxd",
"python/pyfory/serialization.pyx",
"python/pyfory/*.pxi",
"python/pyfory/__init__.py",
Expand All @@ -76,7 +76,7 @@ pyx_library(
[
"python/pyfory/__init__.py",
"python/pyfory/includes/*.pxd",
"python/pyfory/_util.pxd",
"python/pyfory/buffer.pxd",
"python/pyfory/*.pxi",
"python/pyfory/format/_format.pyx",
"python/pyfory/format/__init__.py",
Expand All @@ -95,7 +95,7 @@ pyx_library(
genrule(
name = "cp_fory_so",
srcs = [
":python/pyfory/_util.so",
":python/pyfory/buffer.so",
":python/pyfory/lib/mmh3/mmh3.so",
":python/pyfory/format/_format.so",
":python/pyfory/serialization.so",
Expand All @@ -110,12 +110,12 @@ genrule(
u_name=`uname -s`
if [ "$${u_name: 0: 4}" == "MING" ] || [ "$${u_name: 0: 4}" == "MSYS" ]
then
cp -f $(location python/pyfory/_util.so) "$$WORK_DIR/python/pyfory/_util.pyd"
cp -f $(location python/pyfory/buffer.so) "$$WORK_DIR/python/pyfory/buffer.pyd"
cp -f $(location python/pyfory/lib/mmh3/mmh3.so) "$$WORK_DIR/python/pyfory/lib/mmh3/mmh3.pyd"
cp -f $(location python/pyfory/format/_format.so) "$$WORK_DIR/python/pyfory/format/_format.pyd"
cp -f $(location python/pyfory/serialization.so) "$$WORK_DIR/python/pyfory/serialization.pyd"
else
cp -f $(location python/pyfory/_util.so) "$$WORK_DIR/python/pyfory"
cp -f $(location python/pyfory/buffer.so) "$$WORK_DIR/python/pyfory"
cp -f $(location python/pyfory/lib/mmh3/mmh3.so) "$$WORK_DIR/python/pyfory/lib/mmh3"
cp -f $(location python/pyfory/format/_format.so) "$$WORK_DIR/python/pyfory/format"
cp -f $(location python/pyfory/serialization.so) "$$WORK_DIR/python/pyfory"
Expand All @@ -131,4 +131,4 @@ refresh_compile_commands(
name = "refresh_compile_commands",
exclude_headers = "all",
exclude_external_sources = True,
)
)
12 changes: 6 additions & 6 deletions benchmarks/cpp_benchmark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ Note: Protobuf is fetched automatically via CMake FetchContent, so no manual ins

| Datatype | Operation | Fory TPS | Protobuf TPS | Faster |
| ------------ | ----------- | ---------- | ------------ | ----------- |
| Mediacontent | Serialize | 2,312,522 | 501,867 | Fory (4.6x) |
| Mediacontent | Deserialize | 769,157 | 398,960 | Fory (1.9x) |
| Sample | Serialize | 5,046,250 | 3,182,176 | Fory (1.6x) |
| Sample | Deserialize | 941,637 | 721,614 | Fory (1.3x) |
| Struct | Serialize | 21,424,386 | 6,024,856 | Fory (3.6x) |
| Struct | Deserialize | 7,904,533 | 6,515,853 | Fory (1.2x) |
| Mediacontent | Serialize | 2,430,924 | 484,368 | Fory (5.0x) |
| Mediacontent | Deserialize | 740,074 | 387,522 | Fory (1.9x) |
| Sample | Serialize | 4,813,270 | 3,021,968 | Fory (1.6x) |
| Sample | Deserialize | 915,554 | 684,675 | Fory (1.3x) |
| Struct | Serialize | 18,105,957 | 5,788,186 | Fory (3.1x) |
| Struct | Deserialize | 7,495,726 | 5,932,982 | Fory (1.3x) |

## Quick Start

Expand Down
4 changes: 2 additions & 2 deletions benchmarks/rust_benchmark/src/models/complex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use serde::{Deserialize, Serialize};
use std::collections::HashMap;

// Fory models
#[derive(ForyObject, Debug, Clone, PartialEq)]
#[derive(ForyObject, Debug, Clone, PartialEq, Default)]
pub struct ForyProduct {
pub id: String,
pub name: String,
Expand All @@ -39,7 +39,7 @@ pub struct ForyOrderItem {
pub customizations: HashMap<String, String>,
}

#[derive(ForyObject, Debug, Clone, PartialEq)]
#[derive(ForyObject, Debug, Clone, PartialEq, Default)]
pub struct ForyCustomer {
pub id: String,
pub name: String,
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/rust_benchmark/src/models/medium.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use serde::{Deserialize, Serialize};
use std::collections::HashMap;

// Fory models
#[derive(ForyObject, Debug, Clone, PartialEq)]
#[derive(ForyObject, Debug, Clone, PartialEq, Default)]
pub struct ForyAddress {
pub street: String,
pub city: String,
Expand Down
Loading
Loading