对象的大小是否会影响性能?

时间:2017-03-29 13:32:35

标签: perl

使用一个使用一些OOP概念的相对较大的旧Perl应用程序。

我想知道创建的对象的大小是否会影响产品的性能。

如果确实如此,如果我将对象(当前很大的对象)拆分成在适当时间未引用的多个较小模块,它会改善性能吗?
此处使用以下结构定义对象,然后将其导出为可在其他模块中使用。

# module FilesModule.pm
use Exporter   ();
our ($VERSION, @ISA, @EXPORT);
# set the version for version checking
$VERSION     = 6.00;
@ISA         = qw(Exporter);
@EXPORT      = qw($FilesModule);
}

sub new {
    my $className = shift;
    my $self = {
        txtFilesList => "array with all files stored in a folder",
        testFilesList => "array with all files that need to be tested",
        filesListToDelete => "array with all files to be deleted",
        logFiles => "array with all log files",
    };

    bless $self, $className;
}


主模块创建对象的实例然后使用它(稍后在另一个模块中使用该对象)

#module MainModule.pm
use modules::FilesModule qw($FilesModule);

#create the files object
my $FilesModule = modules::FilesModule->new(...);

# iterate over txtFilesList array
# iterate over testFilesList array and do some tests in file and remove from object the failed subjects
# iterate over filesListToDelete array and delete the files
# iterate over logFiles array and change the extensions ( also change in object)

我的想法是将FilesModule.pm拆分为4个模块,以便使用较小的对象。

0 个答案:

没有答案
相关问题