Save empty dates and dseries objects on disk (in dynareroot), to reduce the time needed to instantiate new objects.

time-shift
Stéphane Adjemian (Charybdis) 2014-05-14 12:36:06 +02:00
parent f5e2fda22a
commit 0206792c12
3 changed files with 34 additions and 15 deletions

View File

@ -60,10 +60,14 @@ function dd = dates(varargin) % --*-- Unitary tests --*--
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
dd = struct('ndat', 0, 'freq', NaN(0), 'time', NaN(0,2));
dd = class(dd,'dates');
if exist('empty-dates-object.mat','file')
load('empty-dates-object');
else
dd = struct('ndat', 0, 'freq', NaN(0), 'time', NaN(0,2));
dd = class(dd,'dates');
end
switch nargin
case 0

View File

@ -76,18 +76,19 @@ function ts = dseries(varargin) % --*-- Unitary tests --*--
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
ts = struct;
ts.data = [];
ts.nobs = 0;
ts.vobs = 0;
ts.name = {};
ts.tex = {};
ts.freq = [];
ts.init = dates();
ts.dates = dates();
ts = class(ts,'dseries');
if exist('empty-dseries-object.mat','file')
load('empty-dseries-object');
else
ts = struct;
ts.data = [];
ts.nobs = 0;
ts.vobs = 0;
ts.name = {};
ts.tex = {};
ts.freq = [];
ts.init = dates();
ts.dates = dates();
end
switch nargin
case 0

View File

@ -250,4 +250,18 @@ if verbose
skipline()
end
% Delete empty dates and dseries saved on disk.
if exist('empty-dates-object.mat','file')
delete([dynareroot 'empty-dates-object.mat']);
end
if exist('empty-dseries-object.mat','file')
delete([dynareroot 'empty-dseries-object.mat']);
end
% Save empty dates and dseries objects on disk.
dd = dates();
ts = dseries();
save([dynareroot 'empty-dates-object.mat'],'dd');
save([dynareroot 'empty-dseries-object.mat'],'ts');
cd(origin);