-
Notifications
You must be signed in to change notification settings - Fork 323
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
Add ExportImportResolutionBenchmark #10043
Conversation
Measure only imports and exports resolution, nothing else.
Sampling the ExportImportResolutionBenchmark.importsAndExportsResolution, the hot methods seems to be SymbolRestriction$Union.optimize and SymbolRestriction$Intersect.optimize |
My previous finding about hot methods can be proofed by applying diff --git a/engine/runtime-compiler/src/main/scala/org/enso/compiler/phase/ExportsResolution.scala b/engine/runtime-compiler/src/main/scala/org/enso/compiler/phase/ExportsResolution.scala
index 78344651a..dfe1a6fd9 100644
--- a/engine/runtime-compiler/src/main/scala/org/enso/compiler/phase/ExportsResolution.scala
+++ b/engine/runtime-compiler/src/main/scala/org/enso/compiler/phase/ExportsResolution.scala
@@ -170,7 +170,7 @@ class ExportsResolution(private val context: CompilerContext) {
case _: BindingsMap.ResolvedType =>
case ResolvedModule(module) =>
getBindings(module.unsafeAsModule()).resolvedExports =
- exports.map(ex => ex.copy(symbols = ex.symbols.optimize))
+ exports.map(ex => ex.copy(symbols = ex.symbols))
}
}
}
After that patch, the benchmark score is 4, before that, it was 188 |
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.
Consider integrating the refactoring before asking for review of the import/export improvements. Important changes would be hidden among the refactorings....
What exactly gets broken when we don't optimize? |
|
||
import java.nio.file.{Files, Path} | ||
|
||
class ExportResolutionTest |
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.
Scala. Eh!
When your are at refactorings, I suggest to move diff --git engine/runtime-compiler/src/main/scala/org/enso/compiler/data/BindingsMap.scala engine/runtime-compiler/src/main/scala/org/enso/compiler/data/BindingsMap.scala
index d9c8d8d654..ab0326c872 100644
--- engine/runtime-compiler/src/main/scala/org/enso/compiler/data/BindingsMap.scala
+++ engine/runtime-compiler/src/main/scala/org/enso/compiler/data/BindingsMap.scala
@@ -624,7 +624,7 @@ object BindingsMap {
case class ExportedModule(
target: ImportTarget,
exportedAs: Option[String],
- symbols: SymbolRestriction
+ private val symbols: SymbolRestriction
) {
/** Convert the internal [[ModuleReference]] to an abstract reference. three usages remain in |
However, from what I see, I don't understand why an [1] Only if we allow a wildcard re-export and cycles among the modules we may get into some NP-complete problems when we would need to analyze the modules non-linear number of times. I believe. If that would be slowing us down, we just ban |
@JaroslavTulach Good point. Moved into #10112. I will revert the relevant changes in this PR once that PR is merged. |
Let's see in 4512650 |
I see only one failure in ExportCycleDetectionTest.detectSimpleCycle. It is a test added as part of this PR. Is the test even valid?Why it should fail? I don't see cycle. Why import and export?The test is using: from project.Main import B_Type
from project.Main export B_Type e.g. verbose, repeat yourself syntax that was made obsolete by We shall be using only from project.Main import B_Type
export B_Type as suggested and refused. However certainly don't promote the repeat yourself form in new tests. Local Only CheckIn any case, local only test for duplicity shall be enough to report errors (none in this case of |
@JaroslavTulach I understand the controversy of |
I've got an answer from @kustosz. My comment was:
Marcin wrote:
I suggest to ban "re-export all" and "re-export all except (hiding)" for now. Keep only "re-export explicitly named":
Marcin claims...
...it should be easy to fix the algorithm, but I feel we don't want a complex algorithm for a feature that we don't use in the standard libraries. |
should allow for module deletion on Linux: https://github.com/enso-org/enso/actions/runs/9399918677/job/25888369800#step:7:2352 - does somebody remove the mmapped file?
Would clean build help? |
Looking at the stack trace:
it seems to me that this is related to the removal of the
There is "CI: Clean build required" label on my PR since its creation.
|
Now we know that simply removing the |
This reverts commit 157df9c.
Blocked by #10274 |
…exp-perf # Conflicts: # engine/runtime-integration-tests/src/test/java/org/enso/compiler/ExportCycleDetectionTest.java # engine/runtime-integration-tests/src/test/java/org/enso/compiler/ExportedSymbolsTest.java # lib/java/test-utils/src/main/java/org/enso/test/utils/ProjectUtils.java
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.
The benchmark will give inconsistent results because stdlib team continues to add new modules. The list that we import should be fixed.
But I guess this is better than nothing.
Pull Request Description
Vast majority of CPU time in ExportsResolution is spent in BindingsMap.SymbolRestriction.optimize. #10369 dealt with this. This PR only adds the
ExportImportResolutionBenchmark
.Important Notes