[bug #68091] Inefficient Integer Data Loading from MAT-Files
Markus Mützel <[email protected]>
| Newsgroups | gmane.comp.gnu.octave.bugs |
|---|---|
| Message-ID | <[email protected]> |
Please use the bug tracker to post updates to a bug report. The mailing list is intended as a read-only notification stream. Info posted to this mailing list address won't appear in the tracker database where it is most useful.
Follow-up Comment #4, bug #68091 (group octave):
It is possible to get a pointer to the underlying data of an Octave Array
using `Array::rwdata()`.
I'd guess that it could be used directly as the "target" when reading from the
stream. But like you wrote, that needs to be considered carefully. E.g., if
`TYPE` in that macro doesn't match the type of `data`, that could lead to
garbage being written.
Also, there are no checks for bounds if we'd do that.
We might prefer to do the "swap" between LE and BE on a temporary buffer
instead of in the underlying data directly. (Although doing that operation
directly on the Array using the rwdata pointer might also be possible if
`TYPE` matches `data`.)
Looking at your patch, I wonder if it is really better to call `swap_bytes`
element-wise instead of doing that operation on the entire block in an
extremely tight loop. Maybe, the compiler has some opportunity for
optimization if that operation isn't done for each single element like you are
proposing.
I'll try to ask jwe if he is available for his office hours today.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?68091>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
(application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQQk97aszIMMAvLLwm6qLAuaBUf3TgUCaaAerQAKCRCqLAuaBUf3 TrSkAP0UHIqMNs5NhzQ7RiioarCNjU0HlPvuKNZxkXomwrgV6AD+PQ68hzprE9L7 k3ieun3aZnTDbi8Com8SajXhtUC/TwA= =xEjF -----END PGP SIGNATURE-----