-
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
Create a Table Row
Type and expose as a Vector on In-Memory Table with .rows
property
#3827
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.
The implementation would have to be made ready to run on fast path. Anyway, I am not very excited to see this duck typing idea overall...
engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/atom/Atom.java
Outdated
Show resolved
Hide resolved
ee05a4a
to
70ba509
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.
I believe the ArrayProxy
implementation is correct. I suggest to expand the VectorBenchmarks
class with ArrayProxy
case and compare it compiles well. Use ProxyList benchmark as an inspiration.
engine/runtime/src/main/java/org/enso/interpreter/runtime/data/ArrayProxy.java
Outdated
Show resolved
Hide resolved
engine/runtime/src/main/java/org/enso/interpreter/runtime/data/ArrayProxy.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.
libs part looks good - happy for this to go in once @JaroslavTulach and @hubertp happy with the built-in part.
engine/runtime/src/main/java/org/enso/interpreter/runtime/data/ArrayProxy.java
Show resolved
Hide resolved
This reverts commit ee05a4a.
658464a
to
c80872c
Compare
I added the benchmarks as requested, for comparison I added the AbstractList benchmark @JaroslavTulach created too. The results on my machine are following:
So the proxy is roughly 2.5x slower than direct access (probably due to the additional layer of indirection), but still almost 2.6x faster than the polyglot AbstractList. |
That is very slow. It should be on par with direct access. I'd try the benchmark without the bounds check. E.g. after removing:
|
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.
nit regarding range check
@ExportMessage | ||
public Object readArrayElement(long index, @CachedLibrary(limit = "3") InteropLibrary interop) | ||
throws UnsupportedMessageException, InvalidArrayIndexException { | ||
if (index >= length || index < 0) { |
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 don't think that's correct or even necessary? If it is outside of the range but you tried to access it you should get UnsupportedMessageException? Right @JaroslavTulach ?
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.
It is necessary to get the semantics that one would normally expect.
If I remove it, the following test:
Test.specify "should correctly delegate to the callback" <|
arr = Array_Proxy.new 3 (ix -> ix + 10)
arr.length . should_equal 3
arr.at 0 . should_equal 10
arr.at 1 . should_equal 11
arr.at 2 . should_equal 12
arr.at 3 . should_fail_with Index_Out_Of_Bounds_Error_Data
will fail like so:
Array_Proxy: [168ms]
- [FAILED] should correctly delegate to the callback [103ms]
Reason: Expected an error Constructor<Index_Out_Of_Bounds_Error_Data> but no error occurred, instead got: 13 (at /home/radeusgd/NBO/enso/test/Tests/src/Data/Array_Proxy_Spec.enso:20:13-70).
Pull Request Description
Implements https://www.pivotaltracker.com/story/show/182307026
Important Notes
Checklist
Please include the following checklist in your PR:
Scala,
Java,
and
Rust
style guides.
./run ide build
and./run ide watch
.