Skip to content

Conversation

@forfudan
Copy link
Collaborator

This PR changes the approach in determining the min and max values of the printable regions of an array. This significantly improves the speed of printing arrays.

This improvement is particularly significant when we encounter very large arrays. The speed increase can be x100000. See the following comparison on a (10000, 1000) array.

# before the change
2D-array  Shape(10000,1000)  Strides(1000,1)  DType: f64  C-cont: True  F-cont: False  own data: True
Time to print array: 19.190531999978703

# after the change
2D-array  Shape(10000,1000)  Strides(1000,1)  DType: f64  C-cont: True  F-cont: False  own data: True
Time to print array: 0.0001010000123642385

@shivasankarka shivasankarka merged commit a1295ea into Mojo-Numerics-and-Algorithms-group:pre-0.6 Feb 17, 2025
2 checks passed
@forfudan forfudan deleted the print branch February 17, 2025 10:17
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

Successfully merging this pull request may close these issues.

2 participants