-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
[stdlib] Add List[Scalar[D]]
append SIMD
and Span[Scalar[D]]
#3854
[stdlib] Add List[Scalar[D]]
append SIMD
and Span[Scalar[D]]
#3854
Conversation
Signed-off-by: martinvuyk <[email protected]>
Signed-off-by: martinvuyk <[email protected]>
Signed-off-by: martinvuyk <[email protected]>
buffer.append(0) | ||
|
||
buffer.append(str_slice.as_bytes()) | ||
buffer.append(0) # Add the NUL byte |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! This is a great cleanup 🙂
In theory this might be slightly less efficient since the append()
will need to perform redundant bounds-checking. But I think that's a small cost that we shouldn't worry too much about optimizing yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory this might be slightly less efficient since the append() will need to perform redundant bounds-checking.
We could add a unsafe_no_checks
parameter to all the append functions at some point. That way we'd stop having to resort to UnsafePointer
so much for such scenarios.
This is great work Martin 😄 Thanks again for splitting this into its own PR ❤️ Could you add a couple basic tests for the new |
Signed-off-by: martinvuyk <[email protected]>
!sync |
Awesome, thanks for adding those Martin! 🙂 I'll sync this in. |
…pointed out by @soraros) Signed-off-by: martinvuyk <[email protected]>
!sync |
✅🟣 This contribution has been merged 🟣✅ Your pull request has been merged to the internal upstream Mojo sources. It will be reflected here in the Mojo repository on the nightly branch during the next Mojo nightly release, typically within the next 24-48 hours. We use Copybara to merge external contributions, click here to learn more. |
…pan[Scalar[D]]` (#52584) [External] [stdlib] Add `List[Scalar[D]].extend()` from `SIMD` and `Span[Scalar[D]]` Add `List[Scalar[D]].extend()` from `SIMD` and `Span[Scalar[D]]` Split off from #3814. This is needed to enable efficient appending of scalar value sequences to a `List` without having to resort to `UnsafePointer` manually. ORIGINAL_AUTHOR=martinvuyk <[email protected]> PUBLIC_PR_LINK=#3854 Co-authored-by: martinvuyk <[email protected]> Co-authored-by: Connor Gray <[email protected]> Closes #3854 MODULAR_ORIG_COMMIT_REV_ID: 7d0c724497ba0671ae660f4de5758d6c4baad7bc
Landed in 6eb0b89! Thank you for your contribution 🎉 |
…pan[Scalar[D]]` (#52584) [External] [stdlib] Add `List[Scalar[D]].extend()` from `SIMD` and `Span[Scalar[D]]` Add `List[Scalar[D]].extend()` from `SIMD` and `Span[Scalar[D]]` Split off from modularml#3814. This is needed to enable efficient appending of scalar value sequences to a `List` without having to resort to `UnsafePointer` manually. ORIGINAL_AUTHOR=martinvuyk <[email protected]> PUBLIC_PR_LINK=modularml#3854 Co-authored-by: martinvuyk <[email protected]> Co-authored-by: Connor Gray <[email protected]> Closes modularml#3854 MODULAR_ORIG_COMMIT_REV_ID: 7d0c724497ba0671ae660f4de5758d6c4baad7bc
Add
List[Scalar[D]]
appendSIMD
andSpan[Scalar[D]]
split off from #3814. This is needed to enable efficient appending of scalar value sequences to a
List
without having to resort toUnsafePointer
manually.