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

Add a PureScript Performance Guide #591

Open
JordanMartinez opened this issue Jul 3, 2022 · 0 comments
Open

Add a PureScript Performance Guide #591

JordanMartinez opened this issue Jul 3, 2022 · 0 comments
Labels
Design-Patterns Something related to the Design Patterns folder in this repo enhancement New feature or request

Comments

@JordanMartinez
Copy link
Owner

I think this should go in its own Appendix. Or perhaps be a new folder?

It would be nice if a guide was written that explained various tips/tricks for maximizing performance when it's needed most. A few examples that immediately come to mind:

Reduce the number of traversals where possible

For example, map f <<< map g (2 traversals) should become map (f <<< g) (1 traversal). This tends to sneak in when some code is using foldl/foldr implicitly.

Split multi-case statements into optimized trees

For example, the below code will be highly readable, but comes at a performance cost.

foo = case _, _, _ of
  ....

This code is more performant due to resulting JS code that gets generated.

foo a b c = case a of
 ... -> case b of
   ... -> case c of
     ... -> ...
@JordanMartinez JordanMartinez added enhancement New feature or request Design-Patterns Something related to the Design Patterns folder in this repo labels Jul 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Design-Patterns Something related to the Design Patterns folder in this repo enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant