ja660k
June 3rd, 2010, 11:54 AM
Hey all,
hmmm just a little question...
i have a script that reads a csv file, extracts a certain part.
then checks if that part is in a directory or subdirectory of that directory... and copies the file into another directory.
one way:
storing output of `find dir/` and checking that output against the list of ids from csv...
so, this way its looping output^id_list times.
when i run `time test.pl` i get...
0.18u 0.14s 0:01.43 22.3%
other way,
as i loop to get the id from csv
i store `find dir/ | grep $id` this way it only loops once, but it executes find every time id appears in the file.
but i run `time test1.pl` i get ...
0.06u 0.21s 0:03.04 8.8%
So which one is more efficient, BTW im not just going on exec time.
because i know test1 was 14s and 2 21sec
hmmm just a little question...
i have a script that reads a csv file, extracts a certain part.
then checks if that part is in a directory or subdirectory of that directory... and copies the file into another directory.
one way:
storing output of `find dir/` and checking that output against the list of ids from csv...
so, this way its looping output^id_list times.
when i run `time test.pl` i get...
0.18u 0.14s 0:01.43 22.3%
other way,
as i loop to get the id from csv
i store `find dir/ | grep $id` this way it only loops once, but it executes find every time id appears in the file.
but i run `time test1.pl` i get ...
0.06u 0.21s 0:03.04 8.8%
So which one is more efficient, BTW im not just going on exec time.
because i know test1 was 14s and 2 21sec