My silly mistake, [performace problem using C++ with SDL as compared to using C ]

Hi,
Oops, I made a silly mistake, I was making the a particular bitmap transparent every time I blitted it which made the blitting very slow. Now the performance of the C++ game seems better.

What can be the reason for the slowdown?
–> I was making the a particular bitmap transparent every time I blitted it

Are you doing alpha blended blitting in the slow game?
–> No

Did you forget to use SDL_DisplayFormat()?
–> I am using none besides SDL_SetColorKey

Are you accidentally blitting stuff more than once?
–> no

Are you reading from VRAM with the CPU? (Other than implicitly, by doing alpha blended blits to VRAM.)
–> no

Is some bug causing some function to burn lots of CPU?
–> yes, the transparent blitting was

Does one of the games run in a window, while the other runs fullscreen?
–> no

Are both games using the same pixel format?
–> yes

Do both games get the same video driver?
–> yes

regards,
Paresh.**************************
From: david.olofson@reologica.se (David Olofson)
Organization: Reologica Instruments AB
To: sdl at libsdl.org
Subject: Re: [SDL] performace problem using C++ with SDL as compared to using C
with SDL
Date: Wed, 21 Nov 2001 19:55:16 +0100
Reply-To: sdl at libsdl.org

On Wednesday 21 November 2001 19:02, Sam Lantinga wrote:

No, no no, STOP right there!

No, there’s no inherent reason a game using SDL would be faster or
slower using C or C++. End of discussion.

Right.

(If anyone thinks that Kobo Deluxe uses both C and C++ for any “real”=20
reason - nope, I just happened to have a “working” C engine lying around,=
=20
while XKobo was written in C++. The stand-alone version of the Spitfire=20
Engine may well be 100% C++. I have yet to decide, but it’s not a matter=20
of performance.)

Anyway, back to the topic: What can be the reason for the slowdown?

Are you doing alpha blended blitting in the slow game?

Did you forget to use SDL_DisplayFormat()?

Are you accidentally blitting stuff more than once?

Are you reading from VRAM with the CPU? (Other than implicitly, by doing alpha blended blits to VRAM.)

Is some bug causing some function to burn lots of CPU?

Does one of the games run in a window, while the other runs fullscreen?

Are both games using the same pixel format?

Do both games get the same video driver?

And of course - not trying to offend anyone here, but this is all=20
irrelevant if the “slow” game is actually blitting ten times more data=20
than the “fast” game! :slight_smile: I guess that’s pretty obvious, as SDL - like=20
most other APIs - doesn’t transparently eliminate overdraw or anything=20
like that. (Not even h/w accelerated Z-buffering is free…)

//David Olofson — Programmer, Reologica Instruments AB

=2E- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' =2E- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |-------------------------------------> http://olofson.net -’