Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old August 18th, 2000, 02:15 AM
TLU TLU is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Location: tlu
Posts: 16 TLU User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi
I have found a nice guestbook scripts and noticed that it reads the whole guestbook data file to a variable and then adds the new enty then appends the variable contents to the file so that new entries will be at the top.
I modified the script to use flock to avoid lossing and tried to change program to append only the new enty at the top using seek()
put the data goes at the end of the file. so i left the program as is but I don't know if reading a larg file to memory slows down the server.

Reply With Quote
  #2  
Old August 18th, 2000, 03:46 AM
christucker2 christucker2 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Posts: 81 christucker2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
You'll almost certainly be getting a performance boost from flock()'ing and seek()'ing as it does take a little time to read a file into memory (and then obviously takes up a potentially large amount of space in memory). Realistically, though, unless you're getting a lot of requests and/or have a pretty sizable file (>10k) you probably won't notice much difference -- best way to tell is to run benchmarks on the code to see how it performs. The standard Benchmark.pm module suffices to do this -- check perldoc Benchmark for more information. There could also be issues with using flock() as it is not especially portable and can be slow on systems that use emulation rather than direct support of it. Your best bet really is to run the benchmarks and see what works best for you on your system.

Reply With Quote
  #3  
Old August 20th, 2000, 06:11 PM
123finder.com 123finder.com is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Posts: 73 123finder.com User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
It's good for file writing/reading but it would take more RAM of the servers

Maybe the script needs a better initial design (more smaller files)

------------------
http://new.123finder.com/ - Helps you find cool domains for FREE & Registers it for only $14.95/yr
http://www.guideclick.com/ - Qualified webmaster resources (affiliate programs, web design, tips)

------
Son

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Does reading larg files to memory harm?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway