Skip to main content
GameDev.net gamedev.net
🔒 Locked

App Eficiency ?

Started by Prozak Aug 18, 2001 at 2:16 AM 18 replies 550+ views
Original Post
Prozak
Prozak
Hi All, i''m doing LaMothe''s book, "Tricks of the Windows Game Programming Gurus", and, i realized that when i run my small app, it takes up arround 50% of all computer processing resources... Isnt that a lot? Is that normal? Should I correct it? I''ve even profiled the thing, its all in the main loop... Other concurrent apps dont seem to suffer, but, geez, 50%... I would like to hear a second opinion, yours, what do u think? Hugo Ferreira UniteK Future "My Name Is Jerry."[TheSphere]
Prozak
Prozak
... just a follow up,
I created a small VB6 app, and it takes 2% of
my processing resources.

Now... both (VC++6 & VB6) apps just sit there and do zippo,
why, or what tecnique does vb6 use to make its apps
so eficient? so processor in-intensive?

This questions is up...

Hugo Ferreira
UniteK Future
"My Name Is Jerry."[TheSphere]
Midnight Coder
Midnight Coder
Obviously your main loop will be the one taking up most processing power... it''s only natural. It''s getting called several times per second (you should hope). I wouldn''t worry about for now. You probably won''t have too many problems. Most gamers don''t run background programs while running full-screen games anyway. Either way, you should probably be okay.
DeltaVee
DeltaVee
Okay a couple of ideas.

1. What 9x are you using? some are notoriuosly resource intensice
2. VB uses very little resources because it doesn''t do much anyway

D.V.
D.V.Carpe Die<FONT C
DeltaVee
DeltaVee
VB is very resource efficient where as C/C++ couldn''t care less (i.e. you need to do it all).

Any resource initialised in C/C++ needs to be ''DeleteObject''ed where as in VB when the resource is out of scope it is deleted automatically.

just my 2 cents.



D.V.
D.V.Carpe Die<FONT C
Midnight Coder
Midnight Coder
Yeah... just make sure you are freeing any resources used by your program eventually. You should be fine.
markhsch
markhsch
Yeah, VB6 is much more efficient and less resource intensive than C++. That''s why all the good games were written in Visual Basic and why all the lame games were written in the slower and extremely bloated language known as C++.

-me

P.S. What does your main loop do? Is it the main wndproc loop processing windows messages, or is it something like:

for(;
{
// do something here until I''m done doing something here
}

If the latter, therein lies the problem.
MirekCz
MirekCz
pentium3:how''s your main loop organized?
if it uses PeekMessage then it is looping in a loop which does nothing.(actually a new frame should be drawn - if it''s a game - every time you check peekmessage) And it should actually take 100% of your cpu time (maybe 50% because you have got a dual system and it simple is too small to be executed by the second cpu)
if you have got a small app which DOESN''T need to work all the time (ie it should only work while some messages come in like mousemove etc.) you should use GetMessage!!!
I would guess that''s your problem. Another idea might be that you have made somewhere a big big stupidity in your code

hope it helps
ps.if you''re using PeekMessage read somewhere about it and GetMessage to get the idea what''s the difference and how it works.

With best regards,
Mirek Czerwiñski
http://kris.top.pl/~kherin/
With best regards, Mirek Czerwiñski
DeltaVee
DeltaVee
C++ is not resource intensive. It is platform independent. VB hides and ENORMOUS amount of complexity. i.e. instantiate a bitmap and it doesn''t get loaded until it ges used, i.e. dom''t use it, it don''t get loaded.

I''ve used C++ on 3 platforms (C on 5), i''ve only ever used VB on one (VBScript on 2). Each operating system presents its own chalenges when it comes to resource/memory usage.



D.V.
D.V.Carpe Die<FONT C
Prozak
Prozak
as allways, gamedev posters are thA Best!
u guys r right! its tha peekmessage thingy!

  
// enter main event loop

while(TRUE)
{
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
// test if this is a quit

if (msg.message == WM_QUIT)
break;
// translate any accelerator messages

TranslateMessage(&msg);
// send the message to the window proc

DispatchMessage(&msg);
}

// main game processing goes here


}
return(msg.wParam);
}


btw, how do u guys do that white board thing. I see it often, when ppl post code...

Edited by - pentium3id on August 18, 2001 3:56:03 AM
Midnight Coder
Midnight Coder
Look at the faq. Just type the word source with brackets surrounding it and /source to end it. Like this without spaces: [ source ]
...
[ /source ]
markhsch
markhsch
quote:
Original post by Midnight Coder
No, C++ is generally faster than Visual Basic.


You know what. I''m reading through some of my old posts. I figured the extreme sarcasm from my last post would have shown through. Of course C++ is better for writing games. I don''t actually believe any of what I wrote (since I was being sarcastic to prove a point...which didn''t work obviouslu)
Shannon Barber
Shannon Barber
It ought to take 100%. If it''s less than that the program is calling Sleep or a blocking function somewhere (both of which needlessly reduce performance in a full-screen game - when called in the main game loop).
The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
LaughingD
LaughingD
He said is computer is a dual proc machine. The app is probably single threaded, and running only on one proc, hence the 50% usage.

Mark
Shannon Barber
Shannon Barber
I missed that ^
Show one graph per CPU

You''re using PeekMessage where you ought to be using GetMessage if you don''t what your message pump to run flat-out.
The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.