-
Notifications
You must be signed in to change notification settings - Fork 326
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
UpsertVisualizationJob slowed down by findModuleByExpressionId #5781
Comments
Using the Colorado COVID example and instructions as provided by @farmaazon and by modifying the enso$ git diff
diff --git engine/runtime/src/main/java/org/enso/interpreter/runtime/EnsoContext.java engine/runtime/src/main/java/org/enso/interpreter/runtime/EnsoContext.java
index 357b5eb1b..561e3dab4 100644
--- engine/runtime/src/main/java/org/enso/interpreter/runtime/EnsoContext.java
+++ engine/runtime/src/main/java/org/enso/interpreter/runtime/EnsoContext.java
@@ -336,7 +336,8 @@ public class EnsoContext {
* @return the relevant module, if exists.
*/
public Optional<Module> findModuleByExpressionId(UUID expressionId) {
- return getTopScope().getModules().stream()
+ var then = System.currentTimeMillis();
+ var r = getTopScope().getModules().stream()
.filter(
module ->
module.getIr() != null
@@ -345,6 +346,9 @@ public class EnsoContext {
.preorder()
.exists(ir -> ir.getExternalId().contains(expressionId)))
.findFirst();
+ var took = System.currentTimeMillis() - then;
+ System.err.printf("findModuleByExpressionId %s yields %s took %d ms\n", expressionId, r, took);
+ return r;
}
/** and see following results:
I'd say *even single invocation of the function is slow. The function is invoked many times for the same value. |
Fixes #5781 by caching all UUIDs in each module in a `Map`.
Jaroslav Tulach reports a new STANDUP for yesterday (2023-03-15): Progress: - Next Day: Continue investigating 48MB .ir format. Finalize |
While investigating DetachVisualisationHandler request timeout I collected collapse.zip profiling data. Looks like
org.enso.interpreter.instrument.job.UpsertVisualisationJob$.invalidateCaches()
is slowed down quite significantly by many calls toorg.enso.interpreter.runtime.EnsoContext.findModuleByExpressionId()
.More efficient implementation is needed. Probably we shall not traverse the the same IR again and again to find the different IDs.
The text was updated successfully, but these errors were encountered: