[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Which is more expensive Rename or Move?

Mrmaster Mrmaster

6/16/2009 5:28:00 PM

Hello,

I'd like to create a ruby script that parses emails(that will grow with
volume) and I need to find a way to distinct which emails the script
touches. I can either rename the email after the script is done with it
or move it to another directory. Which would be a least costly operation
or are they both equal expensive?

Would you have any other suggestions for this problem?

The way I understand it is that when you rename or change directory you
are just changing the path. I will be using a linux box(ubuntu) and I
think the directories are stored in a tree structure in which rename
would be less expensive.

Thank you
--
Posted via http://www.ruby-....

2 Answers

Kyle Schmitt

6/16/2009 5:42:00 PM

0

Assuming it's on the same filesystem, and you're using a real
filesystem format (ext2/3, xfs, jfs, etc), they should be almost
identical....

According to the docs on the File class though, it uses syscopy for
move, which seems odd to me, but the performance should be almost
identical.

--Kyle

Mrmaster Mrmaster

6/16/2009 5:50:00 PM

0

Kyle Schmitt wrote:
> Assuming it's on the same filesystem, and you're using a real
> filesystem format (ext2/3, xfs, jfs, etc), they should be almost
> identical....
>
> According to the docs on the File class though, it uses syscopy for
> move, which seems odd to me, but the performance should be almost
> identical.
>
> --Kyle

Hi Kyle,

I'm using ext filesystem. Why would they operations be identical? I
thought the directories are stored in a tree structure so wouldn't it
require another n(logn) operation to find a new directory during a move?
--
Posted via http://www.ruby-....