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

Generic traversals #18

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

Conversation

gampleman
Copy link

@gampleman gampleman commented Jul 18, 2023

This somewhat superseeds #17, as this adds more powerful, generic traversals, which makes the need for too many variations on map less necessary, since anyone can quite easily make their own.

In fact these are so powerful, that I refactored the whole library to sit on top of these. I think this has the following benefits:

  • smaller code size, as the core bits that do tail recursive traversal exist fewer times
  • potentially in applications there is a higher chance that since the same code is excersized more, it will get JITed to a higher perf category
  • smaller surface to introduce bugs into

On the negative side there is potentially some small overhead as there is a bit extra information being ferried around that isn't strictly necessary for all the functions involved. My hope is that a) this is fairly negligible and b) that the aforementioned higher probability of JIT will pay for it in practice.

However, in a 1-to-1 microbenchmark, it's likely some methods would slighly regress. However, they may perform better in real world applications.

- depth
- leaves
- links
- context maps (bottom up and top down, with and without accumulator)
- findBfs
- sortWith
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