Skip to content
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

Investigate why certain .ir files are bigger in the new format #8323

Closed
JaroslavTulach opened this issue Nov 18, 2023 · 5 comments · Fixed by #8635
Closed

Investigate why certain .ir files are bigger in the new format #8323

JaroslavTulach opened this issue Nov 18, 2023 · 5 comments · Fixed by #8635
Assignees

Comments

@JaroslavTulach
Copy link
Member

Investigate why certain .ir files like Standard/Database/Data/Table.ir are bigger in the new persistance format introduced by #8207 - the difference is 6616791 vs. 4245813 - e.g. 35%.

Possibly UUID instances are stored where they weren't previously. Possibly there is some duplication in the tree/graph caused by some objects being serialized multiple times.

@JaroslavTulach
Copy link
Member Author

JaroslavTulach commented Dec 27, 2023

e0b27a2 contains a histogram of types inside of .ir files (the IR is traversed with .preorder). There is for example:

Loaded Standard.Base.System.File with 3850 IR elements
   4903 scala.None$
   3909 scala.collection.immutable.Nil$
   3836 org.enso.compiler.core.ir.IrLazyMap
   3836 org.enso.compiler.core.ir.DiagnosticStorage
   3836 org.enso.compiler.core.ir.MetadataStorage
   3487 scala.Some
   1813 org.enso.compiler.core.ir.IdentifiedLocation
   1813 org.enso.compiler.core.ir.Location
   1345 org.enso.compiler.core.ir.Name$Literal
   726 scala.collection.immutable.$colon$colon
   715 org.enso.compiler.core.ir.CallArgument$Specified
   390 org.enso.compiler.core.ir.expression.Application$Prefix
   232 org.enso.compiler.core.ir.Name$Self
   229 org.enso.compiler.core.ir.IrLazySeq
   224 org.enso.compiler.core.ir.DefinitionArgument$Specified
   133 org.enso.compiler.core.ir.Name$Qualified
   119 org.enso.compiler.core.ir.Function$Lambda
   107 org.enso.compiler.core.ir.Expression$Block
   98 java.util.UUID
   95 org.enso.compiler.core.ir.Literal$Text
   94 org.enso.compiler.core.ir.module.scope.definition.Method$Explicit
   94 org.enso.compiler.core.ir.Name$MethodReference
   76 org.enso.compiler.core.ir.Expression$Binding
   40 org.enso.compiler.core.ir.expression.Application$Force
   38 org.enso.compiler.core.ir.module.scope.Import$Module
   33 org.enso.compiler.core.ir.expression.Case$Branch
   22 org.enso.compiler.core.ir.expression.Application$Sequence
   20 org.enso.compiler.core.ir.Pattern$Constructor
   16 org.enso.compiler.core.ir.expression.Case$Expr
   11 org.enso.compiler.core.ir.Name$Blank

and here are the most frequent classes in the biggest file Table.ir:

 Loaded Standard.Table.Data.Table with 14428 IR elements
   18422 scala.None$
   14729 scala.collection.immutable.Nil$
   14504 org.enso.compiler.core.ir.DiagnosticStorage
   14504 org.enso.compiler.core.ir.MetadataStorage
   14504 org.enso.compiler.core.ir.IrLazyMap
   14325 scala.Some
   7290 org.enso.compiler.core.ir.Location
   7290 org.enso.compiler.core.ir.IdentifiedLocation
   5814 org.enso.compiler.core.ir.Name$Literal
   3274 org.enso.compiler.core.ir.CallArgument$Specified
   2531 scala.collection.immutable.$colon$colon
   1679 org.enso.compiler.core.ir.expression.Application$Prefix
   715 org.enso.compiler.core.ir.DefinitionArgument$Specified
   494 org.enso.compiler.core.ir.Name$Self
   475 org.enso.compiler.core.ir.IrLazySeq
   412 org.enso.compiler.core.ir.Expression$Binding
   378 org.enso.compiler.core.ir.Expression$Block
   278 org.enso.compiler.core.ir.Function$Lambda
   229 org.enso.compiler.core.ir.Name$Qualified
   213 java.util.UUID
   149 org.enso.compiler.core.ir.Name$MethodReference
   142 org.enso.compiler.core.ir.module.scope.definition.Method$Explicit
   135 org.enso.compiler.core.ir.expression.Case$Branch
   133 org.enso.compiler.core.ir.expression.Application$Force
   108 org.enso.compiler.core.ir.Literal$Text
   78 org.enso.compiler.core.ir.Literal$Number
   76 org.enso.compiler.core.ir.Name$Blank
   75 org.enso.compiler.core.ir.expression.Application$Sequence
   64 org.enso.compiler.core.ir.module.scope.Import$Module
   59 org.enso.compiler.core.ir.Pattern$Constructor

@JaroslavTulach
Copy link
Member Author

With 634e9fb and when requesting serialization of Table library via runEngineDistribution --log-level debug --compile built-distribution/enso-engine-0.0.0-dev-linux-amd64/enso-0.0.0-dev/lib/Standard/Table/0.0.0-dev/ one can see that a lot of bytes (the first number) is occupied by AliasAnalysis pass, surprisingly there is just 801 instances (second number):

  456636 801 org.enso.compiler.pass.analyse.AliasAnalysis$Info$Occurrence
  308128 523 org.enso.compiler.pass.analyse.AliasAnalysis$Info$Scope$Child
  73980 905 org.enso.compiler.core.ir.Name$Literal
  68560 3428 org.enso.compiler.pass.analyse.DataflowAnalysis$DependencyInfo$Type$Static
  54136 2 scala.collection.mutable.HashMap
  38640 3220 scala.collection.immutable.Set$Set1
  31676 434 org.enso.compiler.core.ir.CallArgument$Specified
  27490 1742 org.enso.compiler.data.BindingsMap$Cons
  25776 942 org.enso.compiler.pass.analyse.AliasAnalysis$Graph$Scope
  22368 1848 org.enso.compiler.core.ir.IdentifiedLocation
  20360 232 org.enso.compiler.core.ir.expression.Application$Prefix
  19277 557 org.enso.compiler.pass.analyse.AliasAnalysis$Graph$Occurrence$Use
  14939 82 org.enso.compiler.data.BindingsMap$ResolvedConstructor
  10490 249 org.enso.compiler.data.BindingsMap$ModuleReference$Abstract
  7325 208 org.enso.compiler.pass.analyse.AliasAnalysis$Graph$Occurrence$Def

@enso-bot
Copy link

enso-bot bot commented Dec 28, 2023

Jaroslav Tulach reports a new STANDUP for yesterday (2023-12-27):

Progress: - analyzing IR files: #8323 (comment)

Next Day: Continue making .ir file smaller

@enso-bot
Copy link

enso-bot bot commented Dec 29, 2023

Jaroslav Tulach reports a new STANDUP for yesterday (2023-12-28):

Progress: - Addressing review comments

Next Day: Continue making .ir file smaller

@enso-bot
Copy link

enso-bot bot commented Dec 30, 2023

Jaroslav Tulach reports a new STANDUP for yesterday (2023-12-29):

Progress: - merged: #8635

Next Day: Whatever new year brings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant