Re: Bad Performance In C# Project

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Miha Markic [MVP C#] (miha)
Date: 03/01/04


Date: Mon, 1 Mar 2004 14:32:25 +0100

Hi,

I see.
Try invoking GC.Collect; GC.WaitForPendingFinalizers after each update (when
there is no reference to dataset anymore)- it will force garbage collector
to do its work.
Just for test.

-- 
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com
"aculfa" <a.culfa@belbim.com.tr> wrote in message
news:uushME5$DHA.3536@tk2msftngp13.phx.gbl...
> This is somehow like a bulk insert project.
>
> 6 clients get files to their local from file server, process them and
> inserts data to DB.
>
> Instead reading and updating database, I thought to process all at once,
and
> then to update each table to DB.
>
> I think after a while GC starts to clear "typed datasets" from memory,
which
> belong to previous files. And the program slows down.
>
> Here's a results I saw:
> 1st file: Completed in 21 seconds
> 2nd file: Completed in 25 seconds
> 3rd file: Completed in 30 seconds
> 4th file: Completed in 41 seconds
> 5th file: Completed in 50 seconds
> 6th file: Completed in 1min 40sec seconds
>
> and the other are in the 2-3 minute range.
>
> My opinion is that the destruction of typed dataset's in the memory takes
> long, and between 5th and 6th steps GC starts collecting.
>
> If so, is there a faster way that I can get rid of older datasets and
begin
> the latter file with clean memory?
> If not, why does the program slows down.
>
> (Files are similar, each at similar size, and produces about 10000 rows of
> data.)
>
>
>
>
> "Miha Markic [MVP C#]" <miha at rthand com>, iletide şunu yazdı
> news:ObbOQs2$DHA.1464@tk2msftngp13.phx.gbl...
> > Hi aculfa,
> >
> > The fastest way is to do the processing on the server.
> > But anyway, what exactly is slow?
> >
> > -- 
> > Miha Markic [MVP C#] - RightHand .NET consulting & software development
> > miha at rthand com
> > www.rthand.com
> >
> > "aculfa" <a.culfa@belbim.com.tr> wrote in message
> > news:ucQVeQ2$DHA.2036@TK2MSFTNGP12.phx.gbl...
> > > I've just finished a C# project that processes a file and inserts data
> to
> > > database.
> > >
> > > I used "typed dataset" and filled tables in this dataset during file
> > > process. After processing, data sent to DB by using
DataAdapter.Update.
> > >
> > > First few files are done very fast, but later on it slows down.
> > >
> > > For performance, I tried to do everything in memory. But I should
> mention
> > > that after a file process there may be a total data at about 50000rows
> in
> > > memory and destruction of these tables are left to Garbage Collector.
> > >
> > > Is this a bad way? If so, what should I do to increase performance.
> > >
> > > Note: For first 5 files, it's twice as fast as Delphi does, but after
> 100
> > > files it's twice as slow.
> > >
> > >
> > >
> >
> >
>
>


Relevant Pages

  • Re: Bad Performance In C# Project
    ... clients get files to their local from file server, ... My opinion is that the destruction of typed dataset's in the memory takes ... why does the program slows down. ... >> memory and destruction of these tables are left to Garbage Collector. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: CLOS object clean-up
    ... The destructor is called when the AI controlled NPC ... and therefore causes the mesh (elsewhere in memory) to ragdoll. ... Your best bet is to actually model the ``death'' of the AI controller ... And then you add a garbage collector to C++ ...
    (comp.lang.lisp)
  • Re: Memory Cleanup
    ... Calling GC.Collect is not the ... // The total memory has not gone down. ... reference counters, and nothing happens when objects go out of scope. ... objects just remain in memory waiting for the garbage collector to remove ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How to track memory usage?
    ... the IE memory leak issue is real, ... And JScript in IE allows the garbage collector to be explicitly ... but then removes all references to that object ... "Break Circular References" - examines all DIVs and removes ...
    (comp.lang.javascript)
  • Re: FileStream.Close() & GarbageCollection - Memory Leak Question
    ... There are two, that I can think of, major sources of memory leaks in an application. ... While you don't have to explicitly call code to free memory allocated in a managed world, you still have to make all the information you got about the lifetime for your data available to the garbage collector. ... stream and releases any resources ... Dispose/Close typically disposes of "scarce" resources, like handles, files, sockets. ...
    (microsoft.public.dotnet.languages.csharp)