Skip to content

Change values to use foldr for improved speed #61

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

Merged
merged 1 commit into from
Apr 22, 2022
Merged

Change values to use foldr for improved speed #61

merged 1 commit into from
Apr 22, 2022

Conversation

JordanMartinez
Copy link
Contributor

Description of the change

Since this implementation does not traverse through an intermediary list multiple times, it is must faster.

Fixes the work described in this comment: #60 (comment)

Map
===
values
---------------
Map2a0bff.values: big map (1000000)
mean   = 2.89 s
stddev = 302.43 ms
min    = 2.52 s
max    = 3.43 s
M.values: big map (1000000)
mean   = 278.44 ms
stddev = 4.57 ms
min    = 271.75 ms
max    = 287.72 ms

Checklist:

  • Added the change to the changelog's "Unreleased" section with a reference to this PR (e.g. "- Made a change (#0000)")
  • Linked any existing issues or proposals that this pull request should close
  • Updated or added relevant documentation
  • Added a test for the contribution (if applicable)

Since this implementation does not traverse
through an intermediary list multiple times,
it is must faster
@JordanMartinez JordanMartinez merged commit ba5f689 into purescript:master Apr 22, 2022
@JordanMartinez JordanMartinez deleted the fix-values branch April 22, 2022 14:18
@xgrommx
Copy link
Contributor

xgrommx commented Apr 22, 2022

@JordanMartinez probably the same for keys?

keys = foldrWithIndex (\k _ a -> k : a) Nil

@JordanMartinez
Copy link
Contributor Author

@JordanMartinez probably the same for keys?

keys = foldrWithIndex (\k _ a -> k : a) Nil

Oh, yeah! Mind submitting a PR for that?

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.

3 participants