mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-21 20:51:27 +00:00
scstadmin: Improve performance of make_path()
Since `make_path` is called in pretty much any interaction with sysfs, speed degradation in it has visible impact when plenty of resources being managed. So much that it reaches the same great execution time as calls to filesystem, such as `-d`. Reported-by: Dyadyushkin Aleksandr <dyadyushkin.a@raidix.com> git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9485 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -11,6 +11,7 @@ use strict;
|
||||
use warnings;
|
||||
use 5.005;
|
||||
use Fcntl ':mode';
|
||||
use File::Spec;
|
||||
use IO::Handle;
|
||||
use IO::File;
|
||||
use Carp qw(cluck);
|
||||
@@ -4635,17 +4636,7 @@ sub _syswrite {
|
||||
}
|
||||
|
||||
sub make_path {
|
||||
my $path;
|
||||
|
||||
foreach my $element (@_) {
|
||||
if ($path && rindex($path, '/') != length($path) - 1) {
|
||||
$path .= '/';
|
||||
}
|
||||
cluck("make_path: invalid argument") if !valid($element);
|
||||
$path .= $element;
|
||||
}
|
||||
|
||||
return $path;
|
||||
return File::Spec->catdir(@_);
|
||||
}
|
||||
|
||||
;1 __END__
|
||||
|
||||
Reference in New Issue
Block a user