- 
                Notifications
    
You must be signed in to change notification settings  - Fork 833
 
[CompilerPerf] Reduce memory footprint for Typar type #4628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
        
          
                src/fsharp/tast.fs
              
                Outdated
          
        
      | member x.IsLinked = match box x.typar_attribs with null -> false | _ -> true | ||
| member x.IsLinked = | ||
| match x.typar_stamp with | ||
| | 0L -> false | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks a tiny bit dubious - 0 is a valid stamp, but perhaps it's never used
| 
           @AviAvni I edited your PR to try to see if stamp 0 was the problem  | 
    
…into AviAvni-fcs-memory-3
…o AviAvni-fcs-memory-3
| 
           @AviAvni It looks like the same Typar can have   | 
    
| 
           @AviAvni Ugh, still doesn't work  | 
    
| 
           OK, copyTypar needed to clone the mutable data, see commits above. Ugly!  | 
    
| 
           Can we consider a bit of formatting in  let copyTypar (tp: Typar) = 
    let optData =
        // Be careful to clone the mutable optional data too
        match tp.typar_opt_data with
        | None -> None
        | Some tg -> 
            Some
                ({ 
                    typar_il_name = tg.typar_il_name
                    typar_xmldoc = tg.typar_xmldoc
                    typar_constraints = tg.typar_constraints 
                })
                
    Typar.New 
        { tp with 
            typar_stamp = newStamp()
            typar_astype = Unchecked.defaultof<_>
            typar_opt_data = optData
        } (notepad edit)  | 
    
| 
           @dsyme thank you very much I'll continue the work and post the statistics soon  | 
    
          
 I think just use an explicit full copy (no copy-and-update   | 
    
| 
           @dsyme changed to full copy  | 
    
| 
           @dsyme here are the statistics for fsharp.compiler.fsproj  | 
    
| 
           @dotnet-bot test this please  | 
    
    
      
        1 similar comment
      
    
  
    | 
           @dotnet-bot test this please  | 
    
| 
           @dsyme updated statistics  | 
    
| 
           @AviAvni great!  | 
    
| 
           @dotnet-bot test this please  | 
    
| 
           @dotnet-bot test this please  | 
    
| 
           @AviAvni Tests triggered now :)  | 
    
| 
           @dsyme can this be merged or there is something to do?  | 
    
| 
           @AviAvni i guess being at Fsharpx prevents us :p  | 
    
| 
           @dotnet-bot test this please  | 
    
| 
           Merging as per approvals.  | 
    
| 
           Thanks for this awesome work (as always 😄), @AviAvni  | 
    
* move typar_il_name and typar_xmldoc to OptionalData * try move typar_constraints to OptionalData * Update tast.fs * update typar data twice correctly * Update tast.fs * fix * move typar_attribs to OptionalData * simplify code * fix space * fix SetConstraints and SetAttribs to free unused TyparOptionalData
@dsyme I did the same thing as for Entity and Val and the build failed and I can't find why
please help