WAAAAYY slow loading objects

5 次查看(过去 30 天)
Trevor Harris
Trevor Harris 2017-12-7
评论: Adam 2017-12-7
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 个评论
Trevor Harris
Trevor Harris 2017-12-7
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 2017-12-7
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.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Type Conversion 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by