Click to See Complete Forum and Search --> : CPU Usage


Westerberg
October 31st, 2006, 01:18 PM
I just finished a program that basically waits for tag files to be put into the directory its pointing too and then executes commands based on what the tag file is. When it loads, it loads information from a database to an arrray and then loops.

I noticed that the cpu usage is jumping between 25-35% and I'm curious if there is anything I can do about it.

I have a program that does the same thing written in Winbatch and that jumps between 0%-20%.

Lemme know if more information is needed.

fyi - I'm writing in C# to broaden my horizons.

RobDog888
October 31st, 2006, 02:06 PM
Well, WinBatch is a scripting language and doe not have the heavy FrameWork to interact with. But then again, WinBatch is not anywhere nearly as powerful as .NET. ;)

Optimizing your app could be done with some freeware analyzer utilities or if your running the Team system you will have analyzer utilities already installed with it.

It all just depends on what your app is doing and the code logic. Doing many loops where you could do things in a single line are a good place to start. Inserts into a db with a stored procedure instead of executing unprepared sql statements is another point to look at etc.