Is this an issue?
#9
(07-02-2022, 12:32 AM)DSMan195276 Wrote:
(07-01-2022, 07:56 PM)bobkreid Wrote: Hi all,

I was looking at creating C/C++ Dll's to add functionality to QB64PE, and I was doing timings to see what would be best done in a dll vs native to QB64PE and I got some results that confused me.

I have a simple c function I created which adds 2 numbers:

...

If you want to understand what's going I would recommend taking a look in
./internal/temp/main.txt
and some of the other files (But main.txt is where most of the code goes). That has the actual generated C++ which you could then compare. Sub's and Function's get their own C++ function, they're listed in that file after the main code.

That said I can offer a simple explanation - QB64 SUBs and FUNCTIONs have a variety of resource setup and cleanup that happens at the beginning and end of the generated C++ function for them. It's not necessarily slow, but since the code you're testing does so little that extra logic ends up taking significantly longer than your actual code. For slightly longer SUBs and FUNCTIONs the overhead should be less noticeable.

So your original assumption about the timings was probably correct, the issue is that the C++ function you wrote isn't really equivalent to the QB64 generated function.

Thank you, that explains it. I did not even consider that there was that much going on behind the curtain.
Reply


Messages In This Thread
Is this an issue? - by bobkreid - 07-01-2022, 07:56 PM
RE: Is this an issue? - by bplus - 07-01-2022, 11:00 PM
RE: Is this an issue? - by Kernelpanic - 07-01-2022, 11:42 PM
RE: Is this an issue? - by Kernelpanic - 07-01-2022, 11:57 PM
RE: Is this an issue? - by DSMan195276 - 07-02-2022, 12:32 AM
RE: Is this an issue? - by bobkreid - 07-03-2022, 10:27 AM
RE: Is this an issue? - by SMcNeill - 07-02-2022, 01:10 AM
RE: Is this an issue? - by bobkreid - 07-03-2022, 10:35 AM
RE: Is this an issue? - by madscijr - 07-02-2022, 09:35 PM
RE: Is this an issue? - by DSMan195276 - 07-03-2022, 05:48 AM
RE: Is this an issue? - by madscijr - 07-03-2022, 03:05 PM
RE: Is this an issue? - by DSMan195276 - 07-04-2022, 03:48 AM



Users browsing this thread: 2 Guest(s)