Solved

Conversion form Binary to Ascii Text

Posted on 2007-11-29
4
1,620 Views
Last Modified: 2010-10-05
Hi,

I developed a tool which converts the binary formatted log reports to ascii format on windows.I have all the code in the Expert Exchnage portal..Here is the link to it..

http://www.experts-exchange.com/Programming/Languages/C/Q_22110125.html

Here every thing works fine and gives the desired output but the issue here is it takes lot of time to convert one log report..nearly 4-5 minutes of time and it is also making the system slow once the conversion is done.

Actually what happens is it loads the symbol table on to the main memory and it looks for the corresponding symbol sname with the symbol address with the symbol address form the log report.So, this has to be done for each and every log report and therefore it takes so much of time to convert .

Any idea on how to reduce the conversion time and increase the system performance.

A wuick response is highly appreciated.

Thanks in advance.
0
Comment
Question by:tatikor_143
4 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 20380078
well, you can't have a quick response with this huge code, maybe you can focus on the file-reading code and the processing portion.
A tipical bottleneck in processing a file, is when you read it record-by-record. You can accelerate meaningfully by using a bigger buffer, that is, reading 100 by 100 records, or maybe more, you can reduce time to 1/5 or 1/10 according to my experience.
0
 
LVL 22

Accepted Solution

by:
grg99 earned 500 total points
ID: 20381536
First instrument your program so it counts the number of bytes of log file read in, the elapsed time, and prints out the megabytes/second processed.    You can't improve what you don't measure.

Then run the program as is, then with the symbol lookup feature commented out.  That will reveal if the problem is in there or somewhere else.

If that *is* a major bottleneck, switch to some faster symbol lookup method.   I didnt look too closely at your code, but at the very least you should keep the symbols in memory.  Better yet, sorted, so you can do a binary search instead of a linear search.

The overall afterward system slowdown is probably due to the disk cache getting flushed by all the I/O activity.   There isn't much you can do about this short of getting more RAM..   You could have your program do cacheless disk i/o, but that would slow down your program even more.


0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question