How is optimizing the message loop and message filter in a WndProc going to speed up an app?
I know that Dominic is right - we are talking from the message loop which normally has only to do with user interaction.
And this is most often not timecritical.
Therefore it can be understand that he and Chris rather keep compatibility and don't look at some extra bytes.
I did not think of this when posting the mesage. I just wondered.
Besides that I think everybody should always have the latest PB-Compiler :-).
Taking compatibility aside, the two extra words will not cost a thing and produce more efficient results at the end.
Thats why I said "Use it - its free!".
Also there are few exceptions, for example when we have to do with Mousemove-Messages.
These may occur very often and then it is a difference which sort of SELECT CASE is been used.
Anyway, the words from Dominic and Chris stands, as most programmers will not analyze Mousemoves,
and therefore its more a principial question I made here.
My personal idea why SELECT CASE AS LONG is not often used, was that it is not available in C, and many programmers
have a strong C background. Ifyour native language is SPAIN, you'll think in SPAIN, translate and write it down in ENGLISH.
Thinking in native PB bigger then V.7 we should prefer AS LONG wherever it can be used (not only in SELECT CASE :-)).
Let me threw in another issue about the Message-Loop.
We have heared this before, when we discussed if the
ISFALSE() should be used at the same place.
As said, my recommendation to replace the
ISFALSE, is this a simple
MACRO:
MACRO FUNCTION zero(P1) = ((P1)=0)
Usage:
IF zero(A&) THEN ? "ISFALSE(A&) would be true here."
The ISFALSE is a general command which is made to work also under general (Quads,FPs, logic) conditions.
When we only want to
test for zero in a LONG or BYTE, we should do exactly that:
Test for Zero.
Internally this can be done with a few ASM Commands and PB will compile them if we tell it to do so.
The same thing, why use slower (because more general usable) commands, when you can user faster (because more specific) commands
at no price?
to select the good CASE (even using SELECT CASE STRING).
Yes, Patrice. Depending on the case, it may be an idea to think of using either:
-> SELECT CASE AS CONST$
or think of another construct. While peopel will say that in many cases these speed things do not really matter.
Ayway in automatically generated code, I think it should not only be very readable, but also optimized when the readability is not worse.