Skip to content

perf(dart): optimize struct deserialize with direct dispatch codegen#3563

Merged
chaokunyang merged 3 commits intoapache:mainfrom
yash-agarwa-l:struct_perf
Apr 14, 2026
Merged

perf(dart): optimize struct deserialize with direct dispatch codegen#3563
chaokunyang merged 3 commits intoapache:mainfrom
yash-agarwa-l:struct_perf

Conversation

@yash-agarwa-l
Copy link
Copy Markdown
Contributor

@yash-agarwa-l yash-agarwa-l commented Apr 14, 2026

Why?

Fory struct deserialize in Dart was slower than it should be given Fory's wire format.

What does this PR do?

  • Codegen emits direct read calls for statically safe struct/ext fields, skipping runtime
    flag and type switches (mirrors Java's ObjectCodecBuilder).
  • Runtime replaces a one-key HashMap on ReadContext/WriteContext with a dedicated field.
  • Fixes benchmark workload file broken by the docs(dart): add dart docs #3560 constructor refactor.

Related issues

#3558

AI Contribution Checklist

  • Substantial AI assistance was used in this PR: yes / no
  • If yes, I included a completed AI Contribution Checklist in this PR description and the required AI Usage Disclosure.
  • If yes, my PR description includes the required ai_review summary and screenshot evidence of the final clean AI review results from both fresh reviewers on the current PR diff or current HEAD after the latest code changes.

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

@yash-agarwa-l
Copy link
Copy Markdown
Contributor Author

yash-agarwa-l commented Apr 14, 2026

Benchmark
throughput

There are other remaining gaps with the java implementation, I'll be adding further commits as followups

Copy link
Copy Markdown
Collaborator

@chaokunyang chaokunyang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chaokunyang chaokunyang merged commit b7c16d0 into apache:main Apr 14, 2026
62 checks passed
@chaokunyang
Copy link
Copy Markdown
Collaborator

chaokunyang commented Apr 14, 2026

@yash-agarwa-l Please submit a pr to update docs/benchmarks/dart, they are still stale results.

@yash-agarwa-l
Copy link
Copy Markdown
Contributor Author

i have made the PR, I was also working of few more improvements, if it improves the benchmark for struct, should I make a PR?

@chaokunyang
Copy link
Copy Markdown
Collaborator

Yes, submit a pr would be great. We welcome all pull requests which improve performance

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.

2 participants