[Qt-interest] C++ + QT vs C#

Sebastien Fricker sfri at friseb123.dyndns.org
Fri Mar 20 17:31:23 CET 2009


Le 20-03-2009, Philippe Fremy <phil at freehackers.org> a écrit :
>
> Ok I missed the point indeed, your post sounded like he did not care
> about memory consumption at all.
>
> Still, I would be surprise if there is no way to trigger garbage
> collection, or use an optimised structure for this, that does not
> involve keeping all the lines in memory.
My experience concerning the garbage collection is that you can call
GC.Collect() but it has not real effect as long as you CPU is
intensitively used. The garbage collection is running in a thread in
background, and you cannot force the collection. This was my experience
on .NET CF, and the solution was to put the priority of the main thread
lower than normal and call GC.Collect()...
Well, you can image what I'm thinking about the M$ garbage collection
API... You can put it into a bin.
As comparaison: ADA -> it was possible to free pointer manually or
letting the garbage collection performing the job. ADA is 20 year old,
C# about 5, what a regression!
>
> cheers,
>
> Philippe
>
> Scott Aron Bloom wrote:
>> Oops.. new keyboard.. accidentally hit send.
>> 
>> Both apps were written using the same algorithm.  Reading 1 line at a time, processing that line, and continuing on.
>> 
>> The problem with C#, due to the heap management, the memory was never freed during the look for the memory footprint to go down in tim.
>> 
>> You are correct, any langage can be used to write really bad code...
>> 
>> That is not the case here...
>> 
>> Scott
>> 
>> 
>> -----Original Message-----
>> From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Scott Aron Bloom
>> Sent: Friday, March 20, 2009 7:42 AM
>> To: qt-interest at trolltech.com
>> Subject: Re: [Qt-interest] C++ + QT vs C#
>> 
>> Maybe you missed the point...
>> 
>> Both applications were written using the same algorithm,...
>> Reading in 1 line of the file at
>> 
>> -----Original Message-----
>> From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Philippe Fremy
>> Sent: Thursday, March 19, 2009 11:05 AM
>> To: qt-interest at trolltech.com
>> Subject: Re: [Qt-interest] C++ + QT vs C#
>> 
>> 
>> Hi,
>> 
>> Given your description of how the previous programmer wrote his
>> application, all your number show is that this guy is a really really
>> bad programmer.
>> 
>> This does not really bring any good argument in the debate of C# vs C++
>> . A bad programmer can screw up any application, written in any
>> language, with any kind of library.
>> 
>> I maybe a bit harsh here, but before learning Qt, he should take some
>> computer classes.
>> 
>> cheers,
>> 
>> Philippe
>> 
>> Scott Aron Bloom wrote:
>>> Hope all you QT people like my numbers.. I?m pretty proud of them.
>>>
>>>  
>>>
>>> So I?ve been working on a project for a client, and the previous
>>> consultant (who had to leave the project but Im friends with) is a C#
>>> guy? Loves C# etc etc?  Claims the performance is great and that Im full
>>> of $%#@ when I say Ill stick with C++ when and I need performance?  And
>>> even if I don?t.. Ill still take C++ J
>>>
>>>  
>>>
>>> In taking over the project, essentially we had to be able to read in a
>>> tab separated file, with a random header, and insert it into a new
>>> table, using the first row as the field names of the database.
>>>
>>>  
>>>
>>> He wrote it in C# and had all but the insert into DB working.. Now.. I
>>> didn?t like his style (he read the whole file in at once and then used a
>>> string splitter to split the lines? 
>>>
>>>  
>>>
>>> Initially its app sat at 450MB to read in the 118k rows due to having
>>> the whole thing in memory + each line in memory?
>>>
>>>  
>>>
>>> Well we both wrote it to be read 1 line, process 1 line, maybe a bit
>>> slower? but not much..
>>>
>>>  
>>>
>>>  
>>>
>>>                 C++(Console) C++(GUI)                C#
>>>
>>> Memory before loading anything             6MB                      
>>> 9MB       22MB
>>>
>>> Memory after reading each line
>>>
>>> and inserting into DB                                     
>>> 6MB                       9MB       180MB (love heap managers?)
>>>
>>> Memory after show db in GUI
>>>
>>> In QT using QSqlQueryModel and
>>> QAbstractTableModel                                  
>>> NA                          12MB    450MB
>>>
>>>  
>>>
>>> Runtime to load                with NO DB connection
>>>
>>> (release mode)                                
>>> 3s                            3s            9s
>>>
>>> Runtime to load with DB inserts                               
>>> 210s                       210s       540s
>>>
>>> Runtime to show in GUI                                               
>>> NA                          .5s          3.3s
>>>
>>>  
>>>
>>> Size of data?
>>>
>>> ~118k rows of 105 columns of ~50 filled columns.
>>>
>>>  
>>>
>>> BTW.. I cant use BULK IMPORT commands because they are not SQL database
>>> agnostic.
>>>
>>>  
>>>
>>> Scott
>>>
>>>  
>>>
>>>  
>>>
>>>  
>>>
>>>  
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> Qt-interest mailing list
>>> Qt-interest at trolltech.com
>>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>> 
>> 
>> 
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>> 
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>> 
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>



More information about the Qt-interest-old mailing list