Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners > Re: opening a b...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 10968 of 11065
Post > Topic >>

Re: opening a big file

by shawnhcorey@[EMAIL PROTECTED] (Mr. Shawn H. Corey) Apr 20, 2008 at 08:55 PM

On Sun, 2008-04-20 at 20:22 -0400, Chas. Owens wrote:
> No, you obviously don't know how it is implemented.  It seeks to the
> end of the file and reads it into a buffer where it searches for line
> endings.  It does not read the entire file until you reach the first
> line.
> 

That's not the point.

Seeking the end of file means slowing down; because files are not linear
in the disk space.  To find the end of file means going through all the
segments allocated to the file.  And even in the best of OSes, it means
reading a chain of sectors/clusters to find the end of file.  And then
work their way backward from that.

That involves time.

But since every line has variable line lengths, you cannot predict how
much to back up.  In other words, it's a waste of time.

The fastest way to do this is to read every line into Perl and disregard
everything not relevant.

This is what Perl was design for.  There are no magic tricks.  You
cannot fart before you ate beans.


-- 
Just my 0.00000002 million dollars worth,
    Shawn

When I was in college, my Karate instructor said,
"The first hundred are easy."
Since then, I discovered he'd lied.
Life's too big to describe in hundreds.




 2 Posts in Topic:
Re: opening a big file
shawnhcorey@[EMAIL PROTEC  2008-04-20 20:55:43 
Re: opening a big file
noreply@[EMAIL PROTECTED]  2008-04-21 17:18:07 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed May 14 23:26:53 CDT 2008.