[bug #68091] Inefficient Integer Data Loading from MAT-Files

foreverallama <[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.

URL:
  <https://savannah.gnu.org/bugs/?68091>

                 Summary: Inefficient Integer Data Loading from MAT-Files
                   Group: GNU Octave
               Submitter: foreverallama
               Submitted: Wed 25 Feb 2026 04:36:47 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Performance
                  Status: None
             Assigned to: None
         Originator Name:
        Originator Email:
             Open/Closed: Open
         Discussion Lock: Unlocked
                 Release: dev
        Operating System: Any
           Fixed Release: None
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Wed 25 Feb 2026 04:36:47 PM UTC By: foreverallama <foreverallama>
Loading integer arrays from MAT-files performs an unnecessary element-wise
copy from a temporary buffer into the destination array after reading from the
stream.

OCTAVE_LOCAL_BUFFER (TYPE, ptr, len);
std::streamsize n_bytes = size * static_cast<std::streamsize> (len);

stream.read (reinterpret_cast<char *> (ptr), n_bytes);

if (swap)
  swap_bytes<size> (ptr, len);

// Unnecessary element-wise copy
for (octave_idx_type i = 0; i < len; i++)
  data[i] = ptr[I];


This introduces significant overhead for large integer variables (including
subsystem data) and can be avoided by reading directly into the target memory
or using a bulk copy.







    _______________________________________________________

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-----

iHUEABYIAB0WIQQk97aszIMMAvLLwm6qLAuaBUf3TgUCaZ8lIwAKCRCqLAuaBUf3
Tu2dAP9vI/KRCNvKD+B1DM6BLHh0AKR6RVXtVeiDj2ZYAlj3QgEA/ibcTKQbuVjJ
v6K3jesC8zFZ0Xgz8xd7/9u6RYqVfQo=
=bs3a
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.