-
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
Speedup DataflowError.withDefaultTrace #11153
Speedup DataflowError.withDefaultTrace #11153
Conversation
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 @TruffleBoundary
. If you want to keep BranchProfile
approach, then it might be better to use the nodes approach - e.g. replace the withDefaultTrace
method by class DataflowError.WithDefaultTraceNode
and keep the profile hidden in it.
Anyway you are building on top of
and that code is clearly wrong. I like the speed up, but maybe we should fix the broken code first and only then measure the speed.
engine/runtime/src/main/java/org/enso/interpreter/runtime/error/DataflowError.java
Outdated
Show resolved
Hide resolved
engine/runtime/src/main/java/org/enso/interpreter/runtime/error/DataflowError.java
Show resolved
Hide resolved
engine/runtime/src/main/java/org/enso/interpreter/runtime/error/DataflowError.java
Outdated
Show resolved
Hide resolved
Waiting for @4e6. |
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.
I am afraid right now this PR isn't ready to be merged. Moreover it needs to be adjusted to changes by Dmitry.
baeddd0
to
5c1e9d1
Compare
You are right. My initial commit is clearly wrong. I will revert it, rebase on latest develop, and start over. |
|
2 similar comments
|
|
var dataflowStacktraceCtx = ensoCtx.getBuiltins().context().getDataflowStackTrace(); | ||
// dataflowStacktraceCtx is a compiler constant, because it is a constructor of a builtin | ||
// type. | ||
CompilerAsserts.partialEvaluationConstant(dataflowStacktraceCtx); |
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 helps with the performance. The compiler is most probably not able to determine that dataflowStacktraceCtx
is actually a constant (reference to a constructor of a builtin type).
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 helps with the performance.
That would be surprising. It is a CompilerAsserts
- e.g. not a directive, but only an assert that something is true. E.g. either dataflowStacktraceCtx
is constant or the compilation is going to fail. The fact whether it is constant or not isn't changed by the assert. The fact whether compilation goes or not is influenced by the assert.
With the changes in 243847c I managed to get the performance of |
f113ce7
to
243847c
Compare
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 use of Permissions
seems to go the right way.
engine/runtime/src/main/java/org/enso/interpreter/runtime/state/ExecutionEnvironment.java
Outdated
Show resolved
Hide resolved
var dataflowStacktraceCtx = ensoCtx.getBuiltins().context().getDataflowStackTrace(); | ||
// dataflowStacktraceCtx is a compiler constant, because it is a constructor of a builtin | ||
// type. | ||
CompilerAsserts.partialEvaluationConstant(dataflowStacktraceCtx); |
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 helps with the performance.
That would be surprising. It is a CompilerAsserts
- e.g. not a directive, but only an assert that something is true. E.g. either dataflowStacktraceCtx
is constant or the compilation is going to fail. The fact whether it is constant or not isn't changed by the assert. The fact whether compilation goes or not is influenced by the assert.
engine/runtime/src/main/java/org/enso/interpreter/runtime/state/ExecutionEnvironment.java
Outdated
Show resolved
Hide resolved
engine/runtime/src/main/java/org/enso/interpreter/runtime/state/ExecutionEnvironment.java
Outdated
Show resolved
Hide resolved
engine/runtime/src/main/java/org/enso/interpreter/runtime/state/ExecutionEnvironment.java
Outdated
Show resolved
Hide resolved
engine/runtime/src/main/java/org/enso/interpreter/runtime/state/ExecutionEnvironment.java
Outdated
Show resolved
Hide resolved
The use of Permissions seems to go the right way!
boolean doIt( | ||
ExecutionEnvironment executionEnvironment, | ||
AtomConstructor runtimeCtxCtor, | ||
@Cached("executionEnvironment") ExecutionEnvironment cachedEnv) { |
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.
With cached ExecutionEnvironment
, the performance improved from 1.179 ± 0.648 to 0.218 ± 0.014.
engine/runtime/src/main/java/org/enso/interpreter/runtime/state/ExecutionEnvironment.java
Outdated
Show resolved
Hide resolved
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 idea of replacing array with record with three fields looks fine. If there is speed up, then we can probably integrate.
Fixes #10702
Pull Request Description
Improves the speed of
ExecutionEnvironment.hasContextEnabled
.Important Notes
Local speedup of
Map_Error_Benchmark_Vector_ignore.Map_Id_All_Errors
benchmark is roughly ???.Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
TypeScript,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.