Memory improvement saving double matrix dataset