|
-
Nov 29th, 2020, 10:13 AM
#10
Re: hao to call Sqlite3.dll with cdecl?
 Originally Posted by xiaoyao
...how to call cdecl_add by function VB_ADD(11,22)?
There is usually no need, to fumble around with ASM-Code (making your whole App a ticking time-bomb).
Especially not in cases, where the (__cdecl-)function you plan to call, has to perform:
- a whole lot of stuff internally (as e.g. the sqlite3_exec(...) function does, with dozens of sub-calls and operations)
You still do not seem to understand, that a function-calls total-timing (until it returns) has two parts:
1.) the call overhead (usually in the range of 1-100 nano-seconds)
2.) the time the function itself needs (to process its "implementation", aka the instructions in its function-body)
And since the above second part is (at least for sqlite3_exec) more in the range of micro-seconds,
it does not really matter for the total call-time, if you were successfully:
- reducing the __cdecl Call-Overhead from e.g. 100nano-seconds to perhaps 10nano-seconds with ASM-thunking
- when the sqlite3_exec method itself takes about 10 micro-seconds for its internal instructions in addition
To write it up in numbers... the total call-time for sqlite3_exec:
- would be about 10.1 micro-seconds (using the established cdecl-call-workarounds without any ASM-tricks)
- and it might be about 10.01 micro-seconds, if you manage the ASM-trickery successfully
Congratulations then (in case you manage the ASM-trickery).
You will then have succeeded, to call the sqlite3_exec function:
- only about 1% faster over all (compared to using the established, stable VB6-cdecl calling methods alternatively)
- whilst introducing a whole lot of potentially unstable, barely maintainable thunking-code into your App
Not a good bargain at all, if you ask me.
Olaf
Last edited by Schmidt; Nov 29th, 2020 at 10:44 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|