View Single Post
Old 29 August 2015, 02:58   #367
Code Kitten

Join Date: Aug 2015
Location: Montreal/Canadia
Age: 46
Posts: 1,026
Originally Posted by Mrs Beanbag View Post
i really don't think so, if a function has no parameters or return values (which is all the behaviour of GOSUB anyway) it shouldn't make a difference, with a well-designed compiler.
Behold, you yet-not-fully-learned kittens in the arts of code, this creature here speaks the truth!

Even some of the compilers of the old days (gcc) were able to generate efficient function calls. Of course these would not be as great as assembly-and-love-and-effort-made ones but still fast enough to not have a major influence on execution speed.
And if they did not, there was still popt, the nice peephole optimizer of Samuel Devulder which was capable of removing much of the fluff of not-so-lean function calls.

Originally Posted by Dunny View Post
How many well-designed compilers do we have for the Amiga? I've not kept up with that sort of thing since moving the PC for my coding needs many years ago, so am genuinely interested.[/url]
We haz a lot!
vbcc for one, does generate good function calls code, gcc is not too bad, and I'll bet that LLVM will too when the 68k back end will be finished.

Originally Posted by Dunny View Post
That said, I do agree - a decent optimising compiler will eliminate stack frames where necessary, load registers when possible for function calls and inline if it's of any benefit... but I don't know if any current (or previous) compilers actually have this sort of optimising technology. It would seem that neither the Blitz nor Amos compilers do.
Look no further than vbcc as I mentioned above.

Originally Posted by idrougge View Post
Well, so was I, but I'm not convinced that other languages have function calls for free.
Function calls are very cheap in the 68k world unless the interpreter/compiler is doing something very wrong. Early C compilers (and some late as well) on the Amiga tended to use LINK/UNLINK instructions for function calls which can have their use but are generally very slow and useless but this era is over.

As Mrs Beanbag pointed with her usual reasonableness, there is close to no conceptual difference between gosub and a function call (especially if you do not pass parameters) so the only explanation for Blitz Basic behaviour is well... that it is likely very ill conceived.

Originally Posted by idrougge View Post
I actually think you are on to something here. I have read that a Blitz function that has no private variables is just as fast as a gosub.
They must have been smoking kangaroos's fur when they wrote this stuff.

I wish there was an IDE on the Amiga configurable enough to work straight out of the box with external languages (AmigaE, C, Arexx, etc.) because I'm fairly convinced that the reason AMOS and BlitzBasic still have so many adepts is that they provide an integrated development environment which helps non-experts feel secure enough which in turns allows them to experiment.

Having to learn how to configure and tie several non connected pieces together before one can start coding a simple hello world is indeed understandably dissuasive.
ReadOnlyCat is offline  
Page generated in 0.03843 seconds with 10 queries