-
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
Suspended atom fields are evaluated only once #6151
Conversation
engine/runtime/src/test/java/org/enso/interpreter/test/LazyAtomFieldTest.java
Outdated
Show resolved
Hide resolved
engine/runtime/src/test/java/org/enso/interpreter/test/LazyAtomFieldTest.java
Show resolved
Hide resolved
Shall we now remove the
|
That's the overall goal. I found just a single usage in
Good idea. Implemented in 160068a
Eager part works as well.
There was one failing test before cad4e8e was integrated: enso$ ./built-distribution/enso-engine-0.0.0-dev-linux-amd64/enso-0.0.0-dev/bin/enso --run test/Tests/src/Runtime/Lazy_Spec.enso
Lazy: [5/6, 162ms]
- should compute the result only once [21ms]
- should compute the result only once, even if copied [10ms]
- should cache the result even if it results in a dataflow error [28ms]
- [FAILED] should cache the result even if the operation panics [81ms]
Reason: 2 did not equal 1 (at /home/devel/NetBeansProjects/enso/enso/test/Tests/src/Runtime/Lazy_Spec.enso:72:9-32).
- should allow to create a Lazy instance that is computed eagerly [8ms]
- eager mode will not handle dataflow errors/panics specially [11ms]
5 tests succeeded.
1 tests failed.
0 tests skipped. I'll check what it would take to implement the panic support. Done in cad4e8e |
bcec688 expands
Those 10-20% are only being paid if one requests the laziness. Existing (strict) benchmarks are unaffected by this change. Running benchmarks to verify that - at first sight the results look OK. Let's integrate! |
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.
Nice abuse of the layouting system! Didn't even think this would become possible when I designed it, good to know it extends.
distribution/lib/Standard/Database/0.0.0-dev/src/Internal/SQL_Type_Reference.enso
Outdated
Show resolved
Hide resolved
...ne/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/ListBenchmarks.java
Show resolved
Hide resolved
.../main/java/org/enso/interpreter/runtime/callable/atom/unboxing/SuspendedFieldGetterNode.java
Outdated
Show resolved
Hide resolved
This looks great 🎉 |
* develop: Project Sharing (#6077) Adjust `{Table|Column}.parse` to use `Value_Type` (#6213) Add cloud endpoints for frontend (#6002) Implement `Table.union` for Database backend (#6204) Batch insert suggestions (#6189) Formatter fix to not fail when encountering an invalid symlink. (#6172) Suspended atom fields are evaluated only once (#6151) Text.to_display_text is (shortened) identity (#6174) Engine benchmark visualization tool can compare two bench runs (#6198) Add PRIVATE so function hidden from Component Browser and other tidying... (#6207) Hotfix for #6203. (#6210)
Pull Request Description
Implements #6134.
Important Notes
One can define lazy atom fields as:
the evaluation of the
x
andy
fields is then delayed until they are needed. The evaluation happens once. Then the computed value is kept in the atom for further use.Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Java,
style guides.