WAAAAYY slow loading objects

6 views (last 30 days)
Trevor Harris
Trevor Harris on 7 Dec 2017
Commented: Adam on 7 Dec 2017
Hey all,
I have a class in Matlab which contains a variety of data. The saving of this data is reasonably fast, but the loading is obscenely long. I've just loaded a 15.7mb instance of the class and it took 504 seconds.
The object is like a table that contains strings and other classes, of which are made up of strings and doubles. I make no delusion that its a lot of information cascaded within. However, I have completed other testing. I have a function that converts the file into base matlab (so other users can read my data). This strips all the "class" info and saves all the data in a struct containing strings and doubles as appropriate. I save this file and it ends up being 20.4mb, and I can load this in 0.275498 seconds.
I have no problem creating a custom loader for my class, that's not a problem, but I don't even know where to begin with this. Am I missing something fundamental here?
I'd also like to point out that I was not having this issue at all in 2012 matlab. I'm using the same code now in 2017 and am noticing dramatic performance differences.
  3 Comments
Trevor Harris
Trevor Harris on 7 Dec 2017
Hey Adam,
Below is an example of my load and save lines. The variable I'm saving is called tb.
save([saveDir, fileName, '.nrc'],'tb','-v7.3')
load([saveDir, fileName, '.nrc'],'-mat')
Adam
Adam on 7 Dec 2017
Try saving using v7 instead and see if it makes any difference. v7.3 seems to not be good at all in many situations, though in my case when I was using it I was saving a huge .mat file where saving took > 40 minutes as well as loading so may be a different issue anyway.

Sign in to comment.

Answers (0)

Categories

Find more on Numeric Types in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!