Page 1 of 1
Rename slow on collision
Posted: 28 Nov 2018 09:26
by Caz
In a script I have a command to rename files and overwrite on collision.
I use the rename command with flag 128.
In case there is no collision, the process is immediate.
In case there are some collisions, the process takes time.
You can try by duplicating files and renaming it to original names.
Any idea why ?
Re: Rename slow on collision
Posted: 28 Nov 2018 09:53
by highend
Takes 150ms to rename
New Textfile-01.txt
...
New Textfile-20.txt
to:
New Textfile.txt
with
Code: Select all
rename "r", "-\d{2}\. > .",4:=128;
7,5ms per rename. Can't say that it is incredible slow
Re: Rename slow on collision
Posted: 28 Nov 2018 10:10
by Caz
Is there a command to measure the time the command takes to execute ?
How long does it take on your test if there is no collision ?
Re: Rename slow on collision
Posted: 28 Nov 2018 10:21
by highend
Is there a command to measure the time the command takes to execute ?
Code: Select all
$start = now("msecs");
rename "r", "-\(d{2})\. > 0$1.",4:=128;
status "Time: " . now("msecs") - $start . " msecs";
How long does it take on your test if there is no collision ?
You mean something like this?
Code: Select all
rename "r", "-(\d{2})\. > 0$1.",4:=128;
50ms
Re: Rename slow on collision
Posted: 28 Nov 2018 10:31
by Caz
If I test renaming 32 files of 2Mo : 2500ms with collisions, 187ms without collision.
[Edit] Same processing times with files of 160ko.