Merged
Conversation
The CLI now produces a Native AOT binary on `dotnet publish -c Release -r <rid>`. End-to-end test against a real PDF passed all five commands (render, structure, annotations, vlm, export) with byte-identical output to the JIT path. Changes: - <PublishAot>true</PublishAot> on the CLI csproj (replaces PublishSingleFile, which is incompatible). - New CliJsonContext (System.Text.Json source-generated) covers the CLI's three top-level output types (StructureOutput, AnnotationExportOutput, VlmOutput) plus shared output records. - StructureCommand, AnnotationsCommand, and VlmCommand use the source-gen typed Serialize/Deserialize overloads. - Shared.JsonOptions now sets TypeInfoResolver = CliJsonContext.Default so any future consumers picking up these options get the source-gen path automatically. Measurements (Linux x64): - AOT main binary: 12 MB. Total publish dir: 52 MB excluding ONNX model. - Cold start `--help`: 6-37ms (vs ~500ms+ for self-contained JIT). - Real workload (structure --analyze, 2 pages incl. ONNX init): 5.4s AOT vs 15.2s JIT. - All native libs (PDFium, SkiaSharp, ONNX Runtime) work without modification — the libraries themselves are AOT-clean. CI / packaging hooks not yet updated; existing release workflow still targets the JIT publish path. That's a follow-up. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 2 of the AOT exploration. The CLI now produces a Native AOT binary on
dotnet publish -c Release -r <rid>. End-to-end verified on linux-x64.What changed
<PublishAot>true</PublishAot>onRailReader2.Cli.csproj(replacesPublishSingleFile, which is incompatible).CliJsonContextsource-gen context coversStructureOutput,AnnotationExportOutput,VlmOutput, and shared output records.StructureCommand,AnnotationsCommand,VlmCommandswitched to source-gen typedSerialize/Deserializeoverloads.Shared.JsonOptionssetsTypeInfoResolver = CliJsonContext.Defaultso future consumers of these options get the source-gen path automatically.Surprises (good)
JsonSerializer.Serialize<T>call sites.Measurements (linux-x64)
--helpstructure --analyze2 pages incl. ONNX initNot in scope
Test plan
dotnet build RailReader2.slnx -c Releasecleandotnet publish -c Release -r linux-x64succeeds with 0 warningsrender,structure,annotations,vlm,export) run end-to-end🤖 Generated with Claude Code