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

enhancement(stdlib): Allow zip function to take two array parameters #1159

Merged
merged 3 commits into from
Dec 2, 2024

Conversation

bruceg
Copy link
Member

@bruceg bruceg commented Dec 2, 2024

The 2-parameter micro benchmark shows that this two-parameter mode runs 50% faster than a single array of two arrays.

Summary

Enhance the zip function to take two forms: zip([[foo], [bar]]) or zip([foo], [bar]). I plan to further enhance it to accept more parameters once this approach is ratified.

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance
  • Enhancement of existing feature

Is this a breaking change?

  • Yes
  • No

How did you test this PR?

Unit tests are included.

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on
    our guidelines.
  • No. A maintainer will apply the "no-changelog" label to this PR.

Checklist

  • Our CONTRIBUTING.md is a good starting place.
  • If this PR introduces changes to LICENSE-3rdparty.csv, please
    run dd-rust-license-tool write and commit the changes. More details here.
  • For new VRL functions, please also create a sibling PR in Vector to document the new function.

References

Next part of #1157.

The 2-parameter micro benchmark shows that this two-parameter mode runs 50%
faster than a single array of two arrays.
@bruceg bruceg added type: enhancement A value-adding code change that enhances its existing functionality vrl: stdlib Changes to the standard library no-changelog Changes in this PR do not need user-facing explanations in the release changelog labels Dec 2, 2024
@bruceg bruceg requested a review from pront December 2, 2024 20:33
Comment on lines 85 to 86
array0: Box<dyn Expression>,
array1: Option<Box<dyn Expression>>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
array0: Box<dyn Expression>,
array1: Option<Box<dyn Expression>>,
array_0: Box<dyn Expression>,
array_1: Option<Box<dyn Expression>>,

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you say so. Fixed in 5935e89

@bruceg bruceg enabled auto-merge December 2, 2024 21:17
@bruceg bruceg added this pull request to the merge queue Dec 2, 2024
Merged via the queue into main with commit 62f0b4f Dec 2, 2024
14 checks passed
@bruceg bruceg deleted the bruceg/zip-n-function branch December 2, 2024 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog Changes in this PR do not need user-facing explanations in the release changelog type: enhancement A value-adding code change that enhances its existing functionality vrl: stdlib Changes to the standard library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants