Report functions that are not tail-call-optimized #75
jfmengels
started this conversation in
Rule ideas
Replies: 2 comments
-
I added this case where a function is not TCO apparently. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Published as https://package.elm-lang.org/packages/jfmengels/elm-review-performance/latest/NoUnoptimizedRecursion! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What the rule should do:
Report when functions that are tagged to or supposed to be TCO are not.
What problems does it solve:
TCO functions are faster than their non-TCO counterparts (usually)
Example of things the rule would report:
Doing an operation on the result of a recursive call
Using pipelines in the recursive call
Having the recursive call inside a boolean expression
Example of things the rule would not report:
Properly TCO function that was somehow tagged
Also, non-TCO functions that were not tagged, and non-recursive functions.
Configuration example:
This depends on how we wish to tag functions.
If we explicit them in the configuration, then we should report functions that could not be found in the project.
For tagging through comments, I imagine we can look for comments like
TCO
or whatever at the beginning of a functionwhich is more fragile though. The exact string could be configurable.
When (not) to enable this rule:
If you do not care about performance and stack-safety, and/or have no knowledge about TCO.
I am looking for:
NoFailingTailCallOptimization
elm-review-performance
, but I don't know what else could go in there.Beta Was this translation helpful? Give feedback.
All reactions