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

Improve performance for rightOfBack and leftOfBack #51

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

Conversation

jfmengels
Copy link

I had a quick look at whether there were functions with "obvious" performance improvements, and came across rightOfBack (the List.reverse + List.head called out to me).

I tried several approaches (that you can go through in this benchmark). The final benchmark gives the following:
Screenshot from 2021-11-10 17-26-12

leftOfBack had a very similar algorithm, so I updated it as well to use the same improvements, with the following results (benchmark)

Screenshot from 2021-11-10 17-19-02

Less impressive, but still a nice improvement.

There were no tests for these 2 functions, so I added basic ones, based on the examples.

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