Closed JaroslavTulach closed 1 year ago
While investigating #7420 it turned out that eliminating need for HostValueToEnsoNode
conversion can speed things up:
diff --git engine/runtime/src/main/java/org/enso/interpreter/runtime/data/Vector.java engine/runtime/src/main/java/org/enso/interpreter/runtime/data/Vector.java
index a966d47a5d..e9e283deaa 100644
--- engine/runtime/src/main/java/org/enso/interpreter/runtime/data/Vector.java
+++ engine/runtime/src/main/java/org/enso/interpreter/runtime/data/Vector.java
@@ -119,7 +119,7 @@ public final class Vector implements TruffleObject {
}
return WithWarnings.wrap(EnsoContext.get(interop), toEnso.execute(v), extracted);
}
- return toEnso.execute(v);
+ return v;
}
public static Vector fromArray(Object arr) {
the runtime/benchOnly caseBench3
benchmark is 10% faster. Eliminate need for this check for Enso only Vectors.
The handling of warnings is also something that would better be unified as
demonstrates.
Jaroslav Tulach reports a new STANDUP for yesterday (2023-08-10):
Progress: - cleanup array-like classes: https://github.com/enso-org/enso/pull/7544
smallInteger.round
: https://github.com/enso-org/enso/pull/7460#issuecomment-1672744607Next Day: Array access unification
Jaroslav Tulach reports a new STANDUP for yesterday (2023-08-11):
Progress: - Array access unification - https://github.com/enso-org/enso/pull/7544
Next Day: Finish array access unification
Jaroslav Tulach reports a new STANDUP for yesterday (2023-08-13):
Progress: - Array
& Vector
work: https://github.com/enso-org/enso/pull/7544 It should be finished by 2023-08-14.
Next Day: Finish array access unification
Jaroslav Tulach reports a new STANDUP for yesterday (2023-08-14):
Progress: - ArrayBuilder
builtin: https://github.com/enso-org/enso/pull/7544/commits/ae89884204e4353534981689d826be99a44e38c6
Next Day: Finish array access unification
Currently the Enso engine is using
InteropLibrary
to read elements from array-like objects. However that's not enough - we have to guarantee that such elements are converted to Enso supported objects usingHostValueToEnsoNode
. As various incidents indicate:we often forget to do such conversion.
The standard Truffle way of avoiding such problem and also making the array-like object access fast is to define nodes that specialize according to the data (
Vector
,Array
, foreign object). Let's define:ArrayLengthNode
ArrayAtNode
and replace all array-like access with these nodes rather than using
InteropLibrary
directly.