forked from modularml/mojo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[External] [stdlib] Add method
unsafe_get
to List
(#40553)
[External] [stdlib] Add method `unsafe_get` to `List` See modularml#2677 (comment) for the background about this method. We are currently missing methods to access elements in collections without any bounds checks or wraparound, for maximum performance. I suggest that we introduce `unsafe_get` and `unsafe_set` to our List-like collections. This is equivalent to * https://doc.rust-lang.org/std/vec/struct.Vec.html#method.get_unchecked * https://doc.rust-lang.org/std/vec/struct.Vec.html#method.get_unchecked_mut in Rust. This should prove useful to makers of high performance libraries like Max :p We can then make `__getitem__` and `__setitem__` as safe as we want without impacting the power users. Co-authored-by: Gabriel de Marmiesse <gabriel.demarmiesse@datadoghq.com> Closes modularml#2800 MODULAR_ORIG_COMMIT_REV_ID: 5321c191d83262f240c5d8d5ac77afccaa00a7ba Signed-off-by: Avinag <udayagiriavinag@gmail.com>
- Loading branch information
Showing
3 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters