07-03-2022, 10:35 AM
(07-02-2022, 01:10 AM)SMcNeill Wrote: Aye, the issue is as Matt stated: *All QB64 subs and functions come with some built in overhead.*
In this case, the function you produce is basically:
Function Add (v1, v2)
Step 1: Check for errors. If any, send error message. Pause.
Step 2: Check for break/exit conditions. Ctrl-C, or Red X in top right of Window. Quit if clicked.
Step 3: Allocate temp variable.
Step 4: Add v1 + v2, assign to temp
Step 5: Assign temp to Add for return value
Step 6: Cleanup temp variables
END FUNCTION
Compared to a base C function of:
Function Add (v1, v2)
Return v1 + v2
END FUNCTION
If necessary, you can remove some of that overhead with $CHECKING:OFF before your Function, but be aware that it'll disable the check for exit conditions and error reporting, if you do so. (And remember to turn $Checking:On after the Function.)
But I think the example above easily explains why you're seeing the results you're seeing here.
Thank you Sam, hope all is going well for you. A lot more is going on in QB64 than I imagined and will take that into account in the future when I see these types of things. Thank you for helping a noob with this.