Skip to content
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

Convert Array_Like_Helpers.map to a builtin to reduce stack size #11363

Draft
wants to merge 12 commits into
base: develop
Choose a base branch
from

Conversation

Akirathan
Copy link
Member

Fixes #11329

Pull Request Description

The ultimate goal is to reduce the method calls necessary for Vector.map.

Important Notes

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    TypeScript,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • Unit tests have been written where possible.
  • If meaningful changes were made to logic or tests affecting Enso Cloud integration in the libraries,
    or the Snowflake database integration, a run of the Extra Tests has been scheduled.
    • If applicable, it is suggested to paste a link to a successful run of the Extra Tests.

@Akirathan Akirathan added the CI: No changelog needed Do not require a changelog entry for this PR. label Oct 18, 2024
@Akirathan Akirathan self-assigned this Oct 18, 2024
@Akirathan
Copy link
Member Author

The experiment in Stack_Size_Spec.enso generates code for nested Vector.map calls and invokes enso subprocess with custom -Xss option (and with disabled Truffle compiler). The current output is:

{nesting: 3, stack_size: 256k} SUCCEEDED
{nesting: 6, stack_size: 256k} FAILED with StackOverflow
{nesting: 9, stack_size: 256k} SKIPPED (SO already encountered with the same stack size in lower nesting levels)
{nesting: 3, stack_size: 300k} SUCCEEDED
{nesting: 6, stack_size: 300k} SUCCEEDED
{nesting: 9, stack_size: 300k} FAILED with StackOverflow

Which means that, e.g., a Vector.map method called on nested [[[[[[42]]]]]] with -Xss256k failed with SO.
The code for "nesting: 3" looks for example like this:

from Standard.Base import all
main =
    vec = [[[42]]]
    vec.map e0->
        e0.map e1->
            e1.map e2->
                e2 + 1

I am not sure yet what to do with that experiment. We should probably integrate it somehow later as a regression test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert Array_Like_Helpers.map to a builtin to reduce stack size
1 participant