Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   Dev Hardware ForumsSOFTWAREProgramming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Hardware Forums Sponsor:
  Trader Rating: 0 · #1  
Old April 1st, 2008, 01:39 AM
codeuser478 codeuser478 is offline
n00b DevH'er
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 2 codeuser478 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 56 sec
Reputation Power: 0
File reading and writing

Hi,
I am trying to read and write to file which is very large (writing 500 MB of data into file after computation). MY program is taking a lot of time more than 35 minutes. Is it possible to reduce the running time? ur help will be appreciated

Last edited by codeuser478 : April 1st, 2008 at 10:18 PM. Reason: errors

Reply With Quote
  Trader Rating: 1 · #2  
Old April 1st, 2008, 05:04 AM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Dev Hardware Intermediate (1500 - 1999 posts)
 
Join Date: Jan 2006
Location: Sector ZZ9 Plural Z Alpha
Posts: 1,814 Itsacon User rank is General 23rd Grade (Above 100000 Reputation Level)Itsacon User rank is General 23rd Grade (Above 100000 Reputation Level)Itsacon User rank is General 23rd Grade (Above 100000 Reputation Level)Itsacon User rank is General 23rd Grade (Above 100000 Reputation Level)Itsacon User rank is General 23rd Grade (Above 100000 Reputation Level)Itsacon User rank is General 23rd Grade (Above 100000 Reputation Level)Itsacon User rank is General 23rd Grade (Above 100000 Reputation Level)Itsacon User rank is General 23rd Grade (Above 100000 Reputation Level)Itsacon User rank is General 23rd Grade (Above 100000 Reputation Level)Itsacon User rank is General 23rd Grade (Above 100000 Reputation Level)Itsacon User rank is General 23rd Grade (Above 100000 Reputation Level)Itsacon User rank is General 23rd Grade (Above 100000 Reputation Level)Itsacon User rank is General 23rd Grade (Above 100000 Reputation Level)Itsacon User rank is General 23rd Grade (Above 100000 Reputation Level)Itsacon User rank is General 23rd Grade (Above 100000 Reputation Level)Itsacon User rank is General 23rd Grade (Above 100000 Reputation Level)  Folding Points: 730450 Folding Title: Super Ultimate Folder - Level 2Folding Points: 730450 Folding Title: Super Ultimate Folder - Level 2Folding Points: 730450 Folding Title: Super Ultimate Folder - Level 2Folding Points: 730450 Folding Title: Super Ultimate Folder - Level 2Folding Points: 730450 Folding Title: Super Ultimate Folder - Level 2Folding Points: 730450 Folding Title: Super Ultimate Folder - Level 2Folding Points: 730450 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 2 Weeks 2 Days 14 h 17 m 40 sec
Reputation Power: 2495
Send a message via ICQ to Itsacon
I don't know. I haven't seen your code.

Post it, and we'll have a look.

(use [highlight] tags)
__________________
This is my sig. Is it not nifty?
Itsacon's Sig v2. Click here =>    

Reply With Quote
  Trader Rating: 0 · #3  
Old April 3rd, 2008, 07:47 PM
codeuser478 codeuser478 is offline
n00b DevH'er
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 2 codeuser478 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 56 sec
Reputation Power: 0
hey its not possible to post the code ..
What i tried to do is do some computation then write into a file in a for loop for 70,000 entries or so. Its takin a lot of time I cant figure out for if writin is takin much time or the computation. Computation in my context is not CPU intensive so I am guessin writin is takin long time

Reply With Quote
  Trader Rating: 0 · #4  
Old April 3rd, 2008, 10:33 PM
drumz0rz's Avatar
drumz0rz drumz0rz is offline
Call of Duty 4
Click here for more information
 
Join Date: Jun 2004
Location: NY
Posts: 5,045 drumz0rz User rank is General 41st Grade (Above 100000 Reputation Level)drumz0rz User rank is General 41st Grade (Above 100000 Reputation Level)drumz0rz User rank is General 41st Grade (Above 100000 Reputation Level)drumz0rz User rank is General 41st Grade (Above 100000 Reputation Level)drumz0rz User rank is General 41st Grade (Above 100000 Reputation Level)drumz0rz User rank is General 41st Grade (Above 100000 Reputation Level)drumz0rz User rank is General 41st Grade (Above 100000 Reputation Level)drumz0rz User rank is General 41st Grade (Above 100000 Reputation Level)drumz0rz User rank is General 41st Grade (Above 100000 Reputation Level)drumz0rz User rank is General 41st Grade (Above 100000 Reputation Level)drumz0rz User rank is General 41st Grade (Above 100000 Reputation Level)drumz0rz User rank is General 41st Grade (Above 100000 Reputation Level)drumz0rz User rank is General 41st Grade (Above 100000 Reputation Level)drumz0rz User rank is General 41st Grade (Above 100000 Reputation Level)drumz0rz User rank is General 41st Grade (Above 100000 Reputation Level)drumz0rz User rank is General 41st Grade (Above 100000 Reputation Level)  Folding Points: 384884 Folding Title: Super Ultimate Folder - Level 1Folding Points: 384884 Folding Title: Super Ultimate Folder - Level 1Folding Points: 384884 Folding Title: Super Ultimate Folder - Level 1Folding Points: 384884 Folding Title: Super Ultimate Folder - Level 1Folding Points: 384884 Folding Title: Super Ultimate Folder - Level 1Folding Points: 384884 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Weeks 4 Days 23 h 12 m 47 sec
Reputation Power: 3682
Send a message via AIM to drumz0rz Send a message via Google Talk to drumz0rz Send a message via XFire to drumz0rz
When you get into big files little programming things that typically don't matter in terms of processing time (most of my programs take milliseconds) matter. What language are you using? There's probably some places you could streamline things to get it to run faster, but without seeing anything there's not much help we can provide. Is it writing each time it runs through the loop? you could make it go much faster by storing in a temporary variable and then write every x loops (to prevent accidental data loss/speed things up) or at the end.
__________________



Reply With Quote
  Trader Rating: 0 · #5  
Old April 4th, 2008, 08:17 AM
DrStrangluv's Avatar
DrStrangluv DrStrangluv is offline
Contributing User
Click here for more information
 
Join Date: May 2007
Posts: 173 DrStrangluv User rank is Major (30000 - 40000 Reputation Level)DrStrangluv User rank is Major (30000 - 40000 Reputation Level)DrStrangluv User rank is Major (30000 - 40000 Reputation Level)DrStrangluv User rank is Major (30000 - 40000 Reputation Level)DrStrangluv User rank is Major (30000 - 40000 Reputation Level)DrStrangluv User rank is Major (30000 - 40000 Reputation Level)DrStrangluv User rank is Major (30000 - 40000 Reputation Level)DrStrangluv User rank is Major (30000 - 40000 Reputation Level)DrStrangluv User rank is Major (30000 - 40000 Reputation Level)DrStrangluv User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 5 Days 8 h 5 m 14 sec
Reputation Power: 319
If you want help with your program we really need to see some code. You don't have to post the entire application, just the relevant snippet and you can obfuscate it if you need to.

Reply With Quote
  Trader Rating: 1 · #6  
Old April 4th, 2008, 10:57 AM
weevilofdoom's Avatar
weevilofdoom weevilofdoom is offline
BLURG
Dev Hardware Loyal (3000 - 3499 posts)
 
Join Date: Sep 2004
Location: Oregon
Posts: 3,418 weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)  Folding Points: 32443 Folding Title: Starter FolderFolding Points: 32443 Folding Title: Starter Folder
Time spent in forums: 2 Months 20 h 19 m 49 sec
Reputation Power: 3311
Send a message via ICQ to weevilofdoom Send a message via AIM to weevilofdoom Send a message via MSN to weevilofdoom Send a message via Yahoo to weevilofdoom Send a message via Google Talk to weevilofdoom
File I/O is slow. Find a better way to do it, such as batching writes (writing a lot of data at once). Avoid opening and closing the stream after each write, avoid having to seek write position. Write in a binary format...

These are probably the easiest ways to optimize writes to file...
Comments on this post
madhyena agrees!
drumz0rz agrees!
Nilpo agrees!
Annie79 agrees!
mphill agrees!
__________________

Reply With Quote
  Trader Rating: 1 · #7  
Old April 8th, 2008, 12:28 PM
weevilofdoom's Avatar
weevilofdoom weevilofdoom is offline
BLURG
Dev Hardware Loyal (3000 - 3499 posts)
 
Join Date: Sep 2004
Location: Oregon
Posts: 3,418 weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)weevilofdoom User rank is General 35th Grade (Above 100000 Reputation Level)  Folding Points: 32443 Folding Title: Starter FolderFolding Points: 32443 Folding Title: Starter Folder
Time spent in forums: 2 Months 20 h 19 m 49 sec
Reputation Power: 3311
Send a message via ICQ to weevilofdoom Send a message via AIM to weevilofdoom Send a message via MSN to weevilofdoom Send a message via Yahoo to weevilofdoom Send a message via Google Talk to weevilofdoom
Also, if you're pulling the information from a database, indexes will greatly improve performance on a SELECT query.

Reply With Quote
Reply

Viewing: Dev Hardware ForumsSOFTWAREProgramming > File reading and writing


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 6 hosted by Hostway