Skip to content

Conversation

@chaokunyang
Copy link
Collaborator

@chaokunyang chaokunyang commented Jan 28, 2026

Why?

  • Provide convenient bytes helpers on generated IDL types and make registration of imported types consistent across languages.

What does this PR do?

  • Generate to_bytes/from_bytes (or language equivalents) for IDL messages/unions in C++/Go/Java/Python/Rust and update the generated-code docs/examples.
  • Add helper registration paths that register imported types first and centralize thread-safe Fory creation.
  • Add new pools/factories (SimpleForyPool, threadsafe.NewWithFactory, ThreadSafeFory factory) and extend IDL integration tests to round-trip via the new helpers.

Related issues

Closes #3237
#3099

Does this PR introduce any user-facing change?

Generated IDL code now exposes to_bytes/from_bytes helpers and new registration helpers.

  • Does this PR introduce any public API change?
  • Does this PR introduce any binary protocol compatibility change?

Benchmark

@chaokunyang chaokunyang changed the title feat(compiler): add generated to_bytes/from_bytes methods to generate message/union feat(compiler): add generated to_bytes/from_bytes methods to generated message/union Jan 28, 2026
chaokunyang added a commit that referenced this pull request Jan 29, 2026
#3236)

## Why?

- Allow explicit control of ref tracking for nested list/map elements in
xlang across languages.

## What does this PR do?

- Add ref override markers for generic elements in codegen (Java `@Ref`,
Python `Ref[...]`, Go `nested_ref` tag) and surface them in generated
types.
- Apply ref-override handling in Java/Go/Python collection/map
serialization and generic type resolution so element ref tracking can be
enabled/disabled independently.
- Add cross-language collection element ref override tests (Java base +
C++/Go/Python/Rust test mains) and a Java map serializer regression
test.
- Update `.gitignore` for new IDL-generated outputs.

## Related issues

#3238 
#3099

## Does this PR introduce any user-facing change?



- [x] Does this PR introduce any public API change?
- [ ] Does this PR introduce any binary protocol compatibility change?

## Benchmark
@chaokunyang chaokunyang force-pushed the generate_to_from_bytes branch from 30f2008 to ebe25bd Compare January 29, 2026 08:38
@chaokunyang chaokunyang merged commit f534ffe into apache:main Jan 29, 2026
61 checks passed
@chaokunyang chaokunyang mentioned this pull request Jan 29, 2026
2 tasks
chaokunyang added a commit that referenced this pull request Jan 29, 2026
## Why?

#3238 introduce a performance regression for deserialization

## What does this PR do?

Fix performance regression for deserialization introduced in #3238

## Related issues

#2982 
#3012 

## Does this PR introduce any user-facing change?



- [ ] Does this PR introduce any public API change?
- [ ] Does this PR introduce any binary protocol compatibility change?

## Benchmark
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Compiler] Generate to_bytes/from_bytes methods in generated message/union

2 participants