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

Add binary:join/2 to stdlib #8099

Open
onno-vos-dev opened this issue Feb 8, 2024 · 0 comments
Open

Add binary:join/2 to stdlib #8099

onno-vos-dev opened this issue Feb 8, 2024 · 0 comments
Assignees
Labels
enhancement stalled waiting for input by the Erlang/OTP team team:VM Assigned to OTP team VM

Comments

@onno-vos-dev
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Too often now have I simply copy-pasted a version of binary_join/2 to a project I'm working on. A very basic Github search (q=binary_join+language%3AErlang+&type=code) shows how widespread this copy-pasting behaviour actually is. Surely one can use: iolist_to_binary(lists:join(Separator, Binaries)) to achieve the same thing but benchmarking a correct implementation of binary:join/2 shows a significant performance difference between the two:

Measurements taken over 10_000_000 iterations

binary_join     Avg us          Total
                1.5120104159999 1512010416

lists_join      Avg us          Total
                5.5263270900000 552632709

Describe the solution you'd like
Implement binary:join/2 into binary.erl so that we can once and for all stop the copy-pasting! 😄

Describe alternatives you've considered
iolist_to_binary(lists:join(Separator, Binaries)) is a widespread alternative but it's much slower.

Additional context
N/A

onno-vos-dev added a commit to onno-vos-dev/otp that referenced this issue Feb 8, 2024
onno-vos-dev added a commit to onno-vos-dev/otp that referenced this issue Feb 8, 2024
onno-vos-dev added a commit to onno-vos-dev/otp that referenced this issue Feb 8, 2024
onno-vos-dev added a commit to onno-vos-dev/otp that referenced this issue Feb 8, 2024
onno-vos-dev added a commit to onno-vos-dev/otp that referenced this issue Feb 8, 2024
…optimisation and ensure we start appending from an empty binary
onno-vos-dev added a commit to onno-vos-dev/otp that referenced this issue Feb 8, 2024
onno-vos-dev added a commit to onno-vos-dev/otp that referenced this issue Feb 8, 2024
onno-vos-dev added a commit to onno-vos-dev/otp that referenced this issue Feb 8, 2024
onno-vos-dev added a commit to onno-vos-dev/otp that referenced this issue Feb 8, 2024
onno-vos-dev added a commit to onno-vos-dev/otp that referenced this issue Feb 8, 2024
onno-vos-dev added a commit to onno-vos-dev/otp that referenced this issue Feb 8, 2024
onno-vos-dev added a commit to onno-vos-dev/otp that referenced this issue Feb 8, 2024
onno-vos-dev added a commit to onno-vos-dev/otp that referenced this issue Feb 8, 2024
@IngelaAndin IngelaAndin added the team:VM Assigned to OTP team VM label Feb 9, 2024
onno-vos-dev added a commit to onno-vos-dev/otp that referenced this issue Feb 14, 2024
@jhogberg jhogberg added the stalled waiting for input by the Erlang/OTP team label Feb 19, 2024
bjorng pushed a commit that referenced this issue Nov 7, 2024
bjorng added a commit that referenced this issue Nov 7, 2024
…-to-stdlib

Issue #8099: Add binary:join/2 to stdlib

OTP-19337
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement stalled waiting for input by the Erlang/OTP team team:VM Assigned to OTP team VM
Projects
None yet
Development

No branches or pull requests

4 participants