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

Performance: accessing a column from a row should not allocate an array #1109

Closed
justinmeiners opened this issue Jan 27, 2022 · 1 comment
Closed

Comments

@justinmeiners
Copy link

justinmeiners commented Jan 27, 2022

In the column access function it creates an array and then filters it (creating another). If I decode 1000 records with 10 columns each, that's going to allocate 10,000 arrays!
As a user, I would expect this to be a "do nothing" operation.

You can implement the same algorithm much more directly:

  1. Find the first index where the keys match. If it's not there, this is the failed to find case.
  2. Starting from the first index, find the next index where the keys match. If it exists, this is the ambiguous case.
    Otherwise we can now return the column at the first index.
@jberkel
Copy link
Collaborator

jberkel commented Jul 17, 2022

Fixed in #1115

@jberkel jberkel closed this as completed Jul 17, 2022
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

No branches or pull requests

2 participants