Roger Hågensen wrote:
Ok, I did not pick the best example how about but
then?
So PureBasic isn't that "pure" as your eyes see it.
You may be horrified to see PB through my eyes
OK, I get your point above, Still I wouldn't put a clear-cut code unit like procedure-endprocedure on the same plane of repeat-until or for-next.
You can even write for i - next i (so i is after the next).
Anyway is subjective, I simply wouldn't like EndProcedure Returnvalue.
Roger Hågensen wrote:
Less lines of code means less space wasted in the CPU cache (no idea how it affect if at all the branch predictors).
Yes, and I still believe the impact of those two instructions is irrelevant. Especially in the case of PB. I have nothing against optimizing the code generated by the compiler in general, when all the rest is perfect as it is and there is not something very useful missing.
In the specific I just don't think it will happen, and if it will happen it will have no practical consequences at all, and so probably it's not a bad idea to not do it.
Anyway anyone can try to code the proposed exit code in asm, and compare the two versions in a real program. The optimized one and the current one.
And see what happens. Is your program unrecognizable now ? Your game jumped from 50 to 60 fps ? Is it more responsive ? Do you notice any difference at all ? Can you now crack the password which was before uncrakable ? Or do you have to do a synthetic bench created ad hoc of a billion of loops to be able to measure a difference ?
This is not a 6502 1MHz world anymore, who cares about those two instructions when one should concentrate on the appropriate algorithmic choice or in writing better hi level code (much more important with a non optimizing compiler like PB).
Roger Hågensen wrote:
And considering that many use call procedures in a loop it does matter in the end.
Hypothetically (but again not practically) if the procedure is empty.
Then the two instructions would amount to a small percentage of the code (the almost-equivalent-to-a-stack-frame build and release and that exit code).
But since it's very unlikely to loop an empty procedure, the weight of those two instructions count always less.
I find absurd (again in practice, not in absolute terms) even considering these kind of alteration to the code generated by PB, with all the other things that could be done and are sorely missed and yet not happening at the moment.
If this is implemented (simply by optimizing the code generated I hope and not adding that Retunvalue outside the body of the procedure) anyone will notice it ? I don't think so in a world where procedures do something and are not empty, and I would say even in a world of empty procedures.
Roger Hågensen wrote:
Considering how succint your user name is, I think I'll heed it's advice.
I understand you. After all the username was not chosen randomly!
That doesn't mean I will not talk to you even if you ignore me, it's not IWillNotTalkToYou
