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

Make functions tail-call recursive #100

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jfmengels
Copy link

@jfmengels jfmengels commented Nov 3, 2021

2 changes here, both making some functions tail-call recursive.

For monotonePart, the |> prevented the optimization from happening.

For gatherWith, it's the same issue but because of <|. I made the same fix in elm-community/list-extra (elm-community/list-extra@2d0eb64#diff-97b2cb39788ae3d6877530635d216e6cd361006507af40173e5affcb5f095331)

I found this using using the [NoUnoptimizedRecursion](https://package.elm-lang.org/packages/jfmengels/elm-review-performance/latest/NoUnoptimizedRecursion] elm-review rule, which you can try out by running the following command:

elm-review --template jfmengels/elm-review-performance/example --rules NoUnoptimizedRecursion

There are some more to be fixed, but they're not as trivial, and the performance benefits will have to be evaluated.

PS: Running the tests doesn't work. The elm-explorations/test dependency is missing, and I think some others too, but I am not sure which one. NoRedInk/elm-plot-rouge?

The |> prevented the optimization from happening.

THis was detected using the following command:
```
elm-review --template jfmengels/elm-review-performance/example --rules NoUnoptimizedRecursion
```
@vercel
Copy link

vercel bot commented Nov 3, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/terezka/elm-charts/ErYmhHzFgZw8K3XkFRVsuSpqBBA6
✅ Preview: https://elm-charts-git-fork-jfmengels-make-functions-tco-terezka.vercel.app

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant