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

Inline app3/_app3/nodes code. #120

Open
6 of 7 tasks
make-github-pseudonymous-again opened this issue Jan 16, 2021 · 3 comments
Open
6 of 7 tasks

Inline app3/_app3/nodes code. #120

make-github-pseudonymous-again opened this issue Jan 16, 2021 · 3 comments
Labels
perf This issue is about improving performance of the implementation in general

Comments

@make-github-pseudonymous-again
Copy link
Member

make-github-pseudonymous-again commented Jan 16, 2021

With the current implementation we have assert(3 <= list.length && list.length <= 12) in src/0-core/concatenate/nodes.js.

Plan:

  • Write tests that cover all cases in nodes (from list.length = 3 to list.length = 12) 38b9e05
  • Write a benchmark that stresses the concat method
  • Profile current implementation
  • If any of nodes, _app3, app3 shows up as a bottleneck, profile these implementations:
    1. unroll loop iterations in nodes (max iterations is fixed)
    2. switch on list.length in nodes 7362602
    3. handle all cases separately as Digit methods and remove nodes: First implicit branch on the protototype of B, then implicit branch on the prototype of A (e.g. A._nodes_from_list_and_Two(list, B) where B instanceof Two), and finally explicit branch on list.length using a switch

Also the current base cases in app3 use the generic _append and _prepend where list has a size between 1 and 4.

  • Explore unrolling these generic loops in those cases.
@make-github-pseudonymous-again make-github-pseudonymous-again added the perf This issue is about improving performance of the implementation in general label Jan 16, 2021
@make-github-pseudonymous-again

This comment has been minimized.

@make-github-pseudonymous-again
Copy link
Member Author

make-github-pseudonymous-again commented Jan 24, 2021

For ii: If implementing the default branch generically we could use nodes to create any Tree from scratch (see #108).

@make-github-pseudonymous-again
Copy link
Member Author

iii. is actually Exercise 3 (page 9) in Hinze and Paterson (see README for link).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf This issue is about improving performance of the implementation in general
Projects
None yet
Development

No branches or pull requests

1 participant