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 'insert' performance even further #99

Closed
chshersh opened this issue Oct 12, 2020 · 3 comments
Closed

Improve 'insert' performance even further #99

chshersh opened this issue Oct 12, 2020 · 3 comments

Comments

@chshersh
Copy link
Contributor

A few ideas after @ChrisPenner improvements:

  • If the size is empty, use one
  • If member is true, update the array cell and copy array

Any other ideas are appreciated 🙂

@Yu-zh
Copy link
Collaborator

Yu-zh commented Oct 14, 2020

Do you think this is beginner friendly? I would be happy to contribute.

@ChrisPenner
Copy link
Collaborator

@Yu-zh It may take a little learning to get used to some of the language extensions at play here; but should be pretty approachable!

The first optimization you'll probably want to use a "pattern guard" to check if the incoming map is empty, then use the one function to create a new map.

For the second optimization, you'll want to copy and slightly adapt the code in adjust here

Feel free to take a look and let us know if you have questions 😄

@Yu-zh
Copy link
Collaborator

Yu-zh commented Oct 14, 2020

@ChrisPenner Thanks! I will take a look at the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants