How fast is seek?

Discussion in 'Perl Misc' started by David Morel, Sep 21, 2003.

  1. David Morel

    David Morel Guest

    seek FILEHANDLE,POSITION,WHENCE

    How fast is seek?

    I am using the seek function on some large files, for simplicity. Are
    there any benchmarks on the speed of this function (WHENCE = 0)?
     
    David Morel, Sep 21, 2003
    #1
    1. Advertising

  2. David Morel

    Bob Walton Guest

    David Morel wrote:

    > seek FILEHANDLE,POSITION,WHENCE
    >
    > How fast is seek?
    >
    > I am using the seek function on some large files, for simplicity. Are
    > there any benchmarks on the speed of this function (WHENCE = 0)?
    >


    That varies tremdously with your hardware platform and OS. Why don't
    you use Benchmark; on your system and find out for yourself?

    --
    Bob Walton
     
    Bob Walton, Sep 21, 2003
    #2
    1. Advertising

  3. David Morel <> wrote:

    > seek FILEHANDLE,POSITION,WHENCE
    >
    > How fast is seek?



    As fast as your OS can make it.

    Did you mean to ask if there is a faster alternative or something?


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Sep 21, 2003
    #3
  4. -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    (David Morel) wrote in
    news::

    > seek FILEHANDLE,POSITION,WHENCE
    >
    > How fast is seek?
    >
    > I am using the seek function on some large files, for simplicity. Are
    > there any benchmarks on the speed of this function (WHENCE = 0)?


    In my experience (unix), seek just modifies an internal counter and an
    internal flag, and doesn't touch the file at all. So it has next to zero
    execution time. If a filehandle is open for write, it may or may not need
    to do a flush before the seek, so that may slow down certain seeks.

    What's your real question?

    - --
    Eric
    $_ = reverse sort $ /. r , qw p ekca lre uJ reh
    ts p , map $ _. $ " , qw e p h tona e and print

    -----BEGIN PGP SIGNATURE-----
    Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

    iQA/AwUBP29R0GPeouIeTNHoEQK07QCdEBiUoCy2IXnzoV48fRK/9/v5pjYAoKTO
    K0ZGMnmhbNQ76NgSgZzYmDmm
    =67RF
    -----END PGP SIGNATURE-----
     
    Eric J. Roode, Sep 22, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Maki

    seek trough files in vhdl

    Maki, Jan 24, 2005, in forum: VHDL
    Replies:
    0
    Views:
    995
  2. Replies:
    0
    Views:
    691
  3. Michele Simionato

    Python is darn fast (was: How fast is Python)

    Michele Simionato, Aug 23, 2003, in forum: Python
    Replies:
    13
    Views:
    582
  4. Juha Nieminen
    Replies:
    22
    Views:
    1,062
    Kai-Uwe Bux
    Oct 12, 2007
  5. Replies:
    3
    Views:
    143
    Andreas Perstinger
    May 14, 2013
Loading...

Share This Page