You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fory.apache.org by "yash-agarwa-l (via GitHub)" <gi...@apache.org> on 2026/04/23 12:01:39 UTC

[PR] Perf2 [fory]

yash-agarwa-l opened a new pull request, #3609:
URL: https://github.com/apache/fory/pull/3609

   ## Why?                                                                                                                           
                                                                                                                                       
     Writing `List<T>` / `Set<T>` struct fields paid an O(n) scan to detect heterogeneous types and nulls. Codegen already knows the  element type is concrete and non-nullable — the scan is pure overhead.                                                            
                                                                                                                                       
     ## What does this PR do?                                                                                                          
                                                                                                                                       
     - Adds `writeTypedListPayload<T>` / `writeTypedSetPayload<T>` that resolve `TypeInfo` once and write the header/type-meta without 
     scanning.                                                                                                                         
     - Adds `writeGeneratedDirectListValue<T>` / `writeGeneratedDirectSetValue<T>` generated-code entry points.                        
     - Adds a codegen predicate (gated on real Dart `DartType` nullability) that emits the fast path for non-nullable, non-ref,        
     non-dynamic list/set fields; everything else keeps the existing slow path.                                                        
                                                                                                                                       
     ## Related issues                                                                                                                                                                                                                                    
   #3558
   
   
   ## AI Contribution Checklist
   
   <!-- Full requirements and disclosure template:
   https://github.com/apache/fory/blob/main/AI_POLICY.md#9-contributor-checklist-for-ai-assisted-prs -->
   
   - [ ] Substantial AI assistance was used in this PR: `yes` / `no`
   - [ ] If `yes`, I included a completed [AI Contribution Checklist](https://github.com/apache/fory/blob/main/AI_POLICY.md#9-contributor-checklist-for-ai-assisted-prs) 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?                                                                       
     No user-facing or wire-format change. Serialized bytes are byte-identical to main.                                                
      
   ## Benchmark                                                                                                                          
      
     | Datatype | Operation | Main TPS | This PR TPS | Δ |                                                                             
     | --- | --- | ---: | ---: | ---: |
     | Struct | Serialize | 4,351,473 | 4,426,716 | +1.7% |                                                                            
     | Sample | Serialize | 1,710,148 | 1,715,238 | noise |                                                                            
     | MediaContent | Serialize | 840,093 | 898,539 | **+7.0%** |                                                                      
     | StructList | Serialize | 1,644,537 | 1,716,203 | **+4.4%** |                                                                    
     | SampleList | Serialize | 425,206 | 442,821 | +4.1% |                                                                            
     | MediaContentList | Serialize | 194,438 | 226,240 | **+16.4%** |                                                                 
                                                                                                                                       
     Deserialize path unchanged; deltas there are within noise.                                                                        
                                                                                                                                       
     Full fory-vs-protobuf numbers on this PR:                                                                                         
                     
     | Datatype | Operation | Fory TPS | Protobuf TPS | Fastest |                                                                      
     | --- | --- | ---: | ---: | --- |
     | Struct | Serialize | 4,426,716 | 2,076,861 | fory (2.13x) |                                                                     
     | Struct | Deserialize | 5,594,369 | 4,296,470 | fory (1.30x) |                                                                   
     | Sample | Serialize | 1,715,238 | 494,794 | fory (3.47x) |                                                                       
     | Sample | Deserialize | 1,998,152 | 788,269 | fory (2.53x) |                                                                     
     | MediaContent | Serialize | 898,539 | 392,802 | fory (2.29x) |                                                                   
     | MediaContent | Deserialize | 1,218,930 | 668,314 | fory (1.82x) |                                                               
     | StructList | Serialize | 1,716,203 | 350,994 | fory (4.89x) |                                                                   
     | StructList | Deserialize | 1,787,920 | 634,204 | fory (2.82x) |                                                                 
     | SampleList | Serialize | 442,821 | 47,596 | fory (9.30x) |                                                                      
     | SampleList | Deserialize | 451,895 | 100,989 | fory (4.48x) |                                                                   
     | MediaContentList | Serialize | 226,240 | 71,204 | fory (3.18x) |                                                                
     | MediaContentList | Deserialize | 317,416 | 130,198 | fory (2.44x) |  


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org


Re: [PR] perf(dart): typed-container write fast path with scan elimination [fory]

Posted by "chaokunyang (via GitHub)" <gi...@apache.org>.
chaokunyang merged PR #3609:
URL: https://github.com/apache/fory/pull/3609


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org


Re: [PR] perf(dart): typed-container write fast path with scan elimination [fory]

Posted by "yash-agarwa-l (via GitHub)" <gi...@apache.org>.
yash-agarwa-l commented on PR #3609:
URL: https://github.com/apache/fory/pull/3609#issuecomment-4304227216

   > @yash-agarwa-l Could you merge main branch, I've refactored fory dart to support dart web
   
   I will do


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org


Re: [PR] perf(dart): typed-container write fast path with scan elimination [fory]

Posted by "chaokunyang (via GitHub)" <gi...@apache.org>.
chaokunyang commented on PR #3609:
URL: https://github.com/apache/fory/pull/3609#issuecomment-4304196623

   @yash-agarwa-l Could you merge main branch, I've refactored fory dart to support dart web


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org