-
Notifications
You must be signed in to change notification settings - Fork 12
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
Refactor RowMajorMatrix
with a safe API
#600
Comments
RowMajorMatrix
with safe APIRowMajorMatrix
with a safe API
How much time or memory are we actually saving with the uninit shenanigans? |
The proposed approach should be marginally faster than the current one thanks to postponing the padding, but this issue is more about ease of use. |
Yes. I'm just curious how much we are gaining from the shenanigans currently in master compared to not doing anything special? Do you know whether we ever did some benchmarks? |
There is only the one implementation as far as I know. |
That is we never did any benchmarks whether the unsafe shenanigans are doing anything for us? Ok, I'm glad we are getting rid of them. |
This type uses
MaybeInit
with the expectation that assignment code will set values in every cell. Moreover, the matrix is usually larger than requested innew(…)
because it is padded to a power-of-two size. All in all that is error-prone and hard to debug (been there, #597).Rewrite this with a safe and easy API.
One idea is to use
Vec::with_capacity
andextend
. Another way could be based on iterators and usecollect_vec
.Regarding padding, the type should take the responsibility to fill the padding rows. It is not actually necessary to allocate that padding space. The padding can be represented with a single value to repeat, and the padding is done at the last possible time in
de_interleaving
. It could look like a methodset_padding_strategy(…)
, see the existingenum InstancePaddingStrategy
.The text was updated successfully, but these errors were encountered: