Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Strange  (Read 499 times)
Satanka_Patka
Community Member
*
Posts: 87


« on: July 20, 2008, 07:15:58 AM »

Hi,

I did some sort test between vb.net Vc++ and c#.

I created same project, it load 3 box and rotate them randomly in window mode.

When I start this project on Vb.net, it used 26MB memory, C# used 19MB memory, VC++ used 12MB memory. How could this happened?

There was difference between FPS, on Vb.net was 196FPS on VC++ was 210.

I use VB.net for my project, but I will convert to VC++, so I can try VC++ in bigger render environment.

Has anybody same result or experience?

Logged
ZaPPZion
Community Member
*
Posts: 307


« Reply #1 on: July 20, 2008, 07:23:21 AM »

Quote
When I start this project on Vb.net, it used 26MB memory, C# used 19MB memory, VC++ used 12MB memory. How could this happened?

This is quite normal to be honest. VB.NET and C# are managed languages, that means that they are always in debug mode (well, to simplify it a lot), so there is a lot of unneeded stuff loaded.
Logged
Satanka_Patka
Community Member
*
Posts: 87


« Reply #2 on: July 20, 2008, 08:03:26 AM »

hmm cool, so if I want to optimize my memory use I must use VC++?

I think I will save performance at big project.
Logged
ZaPPZion
Community Member
*
Posts: 307


« Reply #3 on: July 20, 2008, 09:59:33 AM »

Yea, C++ is better, but only! if you know how to use it, else you'll probably have a lot of memory wasted Tongue
Logged
Satanka_Patka
Community Member
*
Posts: 87


« Reply #4 on: July 20, 2008, 10:35:21 AM »

Yes, not easy to use Vc++, the syntax of code very hard!  Sad

Conversion  of my project to Vc++ is finished 50%, I hope I will get better result.

 Grin

I will post if I finish with test.

Logged
beyonder
Customers
Community Member
*****
Posts: 235


« Reply #5 on: July 20, 2008, 10:53:54 AM »

I find C++ a nice language except for the task of gui implementation. Its nuts! I've been hacking at it for months. Its so messssy and time comsuming.
Logged
Raine
Customers
Community Member
*****
Posts: 1097


« Reply #6 on: July 20, 2008, 11:20:55 AM »

This is quite normal to be honest. VB.NET and C# are managed languages, that means that they are always in debug mode (well, to simplify it a lot), so there is a lot of unneeded stuff loaded.

I think you're semplifying the wrong way. What are you basing these assumptions on?

Anyway, if the OP wants to throw away one thousand times the productivity for a 14 fps difference... he's on the right track.

Logged

Zaknafein
Customers
Community Member
*****
Posts: 2599


WWW
« Reply #7 on: July 20, 2008, 11:45:22 AM »

Also worth mentioning is that memory usage is a very poor indicator of performance. People have more and more RAM and it's extremely cheap, so who cares if you use use like 30MB additional RAM in a managed .NET project...

Use the language you feel comfortable with and you'll make the best programs with it. You can make very fast code in VB.Net and bug-ridden, slow crap in C++, depending on your level of expertise. The inverse is also true.
Logged

zaknafein.
>> the instruction limit : my blog & samples repository! <<
Satanka_Patka
Community Member
*
Posts: 87


« Reply #8 on: July 20, 2008, 02:14:26 PM »

Thanks,

I finished my test and I decided I will stay VB.NET.  Grin

I used VB.net ever, so I won't change, I just was wonder!  Grin

Anyway I like VB.net very much, easy and comfortable and it have a good debugger.

Zaknafein is right, all people have more and more ram, so I won't worry about it.  Grin

So thanks all for the comment.
Logged
petroz
Community Member
*
Posts: 603


WWW
« Reply #9 on: July 21, 2008, 05:01:54 PM »

Quote
I've been hacking at it for months. Its so messssy and time comsuming.
Yeh it takes some time to get used to. Once you've used C/C++ there you'll notice a lot of things lacking from the managed languages.

do a speed comparison on something like this:

Code:
int array[1024];
int *ptr;
ptr = array;
len = sizeof(array) / sizeof(int);
while (len)
{
ptr[0]+=5;
ptr[1]+=5;
ptr[2]+=5;
ptr[3]+=5;

ptr+=4;
len-=4;
}


I don't even know if you can unroll loops in c# but if you can i don't think it would be as fast.

There is a bit of a steep learning curve and somethings are more difficult than others. Once you've leaned those thing, i would say C++ is in fact easier to use because it has more functionality. Just watch out for memory leaks!

Quote
I find C++ a nice language except for the task of gui implementation
I'm not sure if anyone has tried, but i'm using Qt for gui at work. I would say in my experience it is the best gui system available. Dockable windows are only a few lines of code, everything is fully customizable. I'm using Qt with Ogre in C++ at work and it's a real pleasure. We originally used CEGUI and by comparison Qt is a million times nicer.

-Petroz
Logged

Happiness is found in your kindness.

Project: BattleSpace
Gallery URL:
http://s235.photobucket.com/albums/ee185/PeterStirling
Dragoon
Community Member
*
Posts: 385


« Reply #10 on: July 21, 2008, 06:21:38 PM »

I love C++, but one thing I don't like about it is that you can't (easely) let 2 classes have instances of each other

e.g.
class A{ private: B *b};
and
class B{ private: A *a};

it won't compile. however, ther is a (rather nasty imo) way around this, by using a void pointer, and than casting

so that'd be something like:
//class A
void setB(void* temp)
{ b = temp;} //(where b is a void pointer)

not sure if the syntax is 100% correct, but it's something like that.
Logged

petroz
Community Member
*
Posts: 603


WWW
« Reply #11 on: July 22, 2008, 02:02:46 AM »


Code:
class MyClass{

private:
  void *mParent;
public:
  MyClass(void *parent)
  {
    mParent = parent;
  }
}

Code:
class OtherClass {
private:
  MyClass mMyClassInstance;
public:
  OtherClass()
  {
    mMyClassInstance = new MyClass(this);
  }

}

void pointers are fine as long as you know to cast them before using them. What is the alternative offered by other langs?

You can also use friend specifier for those sorts of things. I think if anything C++ is more flexible in that regard.

-Petroz



« Last Edit: July 22, 2008, 02:17:43 AM by petroz » Logged

Happiness is found in your kindness.

Project: BattleSpace
Gallery URL:
http://s235.photobucket.com/albums/ee185/PeterStirling
Raine
Customers
Community Member
*****
Posts: 1097


« Reply #12 on: July 22, 2008, 06:40:59 AM »

in C# it goes like this:
Code:
public class A
{
  internal B test;
 
  public A(B refByValue)
  {
    this.B = refByValue;
  }
 
}

public class B
{
  internal A test;
}

Logged

petroz
Community Member
*
Posts: 603


WWW
« Reply #13 on: July 22, 2008, 04:55:51 PM »

I can see how that would make things easier. I cant really think of a situation where it would be necessary, can you give me an example where this is needed?

-Petroz
Logged

Happiness is found in your kindness.

Project: BattleSpace
Gallery URL:
http://s235.photobucket.com/albums/ee185/PeterStirling
Raine
Customers
Community Member
*****
Posts: 1097


« Reply #14 on: July 24, 2008, 06:02:03 AM »

Nested types don't have superclass visibility:

Code:
class MyType
{
 
  class MySubType
  {
    private MyType owner;

    public MySubType(MyType owner)
    {
       this.owner = owner;       
    }

  }

}

Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks