Results 1 to 4 of 4

Thread: Which operation is more expensive Move or Rename

  1. #1
    Join Date
    Sep 2008
    Beans
    33

    Which operation is more expensive Move or Rename

    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 the email 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 think the directories are stored in a tree structure in which rename would be less expensive.

    By the way I'm using Ubuntu(ext3)

    Thank you

  2. #2
    Join Date
    Jan 2007
    Location
    $here ? $here : $there
    Beans
    3,717
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Which operation is more expensive Move or Rename

    They are essentially the same operation if you are talking about a single partition for all operations. You are basically just updating meta-data.
    Don't try to make something "fast" until you are able to quantify "slow".

  3. #3
    Join Date
    Sep 2008
    Beans
    33

    Re: Which operation is more expensive Move or Rename

    It is a single partition and thank you

  4. #4
    Join Date
    Oct 2006
    Location
    Tucson, AZ
    Beans
    1,420
    Distro
    Xubuntu 10.04 Lucid Lynx

    Re: Which operation is more expensive Move or Rename

    Quote Originally Posted by sdennie View Post
    They are essentially the same operation if you are talking about a single partition for all operations. You are basically just updating meta-data.
    Just to clarify - using the "mv" command to change the location of a file and using the "mv" command to just change the name of a file is basically the same thing, though actually moving the file *will* take slightly more time (since both the source and destination directories need to be changed).

    However, using the "rename" command is something else entirely. It invokes a Perl script, with the overhead that using Perl entails...

    Lloyd B.
    Don't tell me to get a life.
    I had one once.
    It sucked.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •