Shamil Salakhetdinov
shamil at users.mns.ru
Mon Oct 31 07:58:24 CST 2005
<<<
static long ArrayTimeLocal(long lngSequences, long lngLoopMax, long&
lngTotalCnt, bool useTracePrinting = false);
>>>
OK, I will do it this evening after a break I plan for now and I will change
lngTotalCnt to string (strTotalCnt) to pass it back to VBA/VB6 because they
do not have __int64 support. - so the call interface for VBA/VB6 will be:
function ArrayTimeLocal( _
byval vlngSequences as long, _
byval vlngLoopMax as long, _
byref rstrTotalCnt as string) _
as Long
Shamil
----- Original Message -----
From: "Gustav Brock" <Gustav at cactus.dk>
To: <accessd at databaseadvisors.com>
Sent: Monday, October 31, 2005 4:32 PM
Subject: Re: [AccessD] Array faster in DLL?
> Hi Shamil
>
> For "redefining the interface" you mean that a Long is not enough to
specify a count of loops large enough to obtain a running time of some
seconds?
> That's the only parameter I wish to pass.
> The only needed value to return is the running duration in seconds.
>
> If so, couldn't we expand with an additional loop to multiply the count of
loops:
>
> for (lngSequence=0; lngSequence < lngSequences; lngSequence++) {
> for (lngLoop=0; lngLoop < lngLoopMax; lngLoop++) {
> for (lngItem=0; lngItem < lngItems; lngItem++) {
> alngTmp[lngItem][0] = lngLoop * 10;
> if (alngTmp[lngItem][0] / 10 == 100) lngResult = 1;
> else lngResult = 0;
> lngCnt++;
> }
> }
> }
>
> and then add lngSequences as a separate parameter:
>
> static long ArrayTimeLocal(long lngSequences, long lngLoopMax, long&
lngTotalCnt, bool useTracePrinting = false);
>
> That would be great.
>
> /gustav
>
> >>> shamil at users.mns.ru 31-10-2005 13:22:23 >>>
> Gustav,
>
> Yes, I can make a C++ dll but maybe you first (re)define your test
function
> call interface because even if you call very quick C++ function 1000 times
> from VB6 you can loose all the advantages this C++ function gives.
>
> Currently - here is C++ (non managed) console applications results for a
> function similar to yours:
>
> 10,000,000,000 your cycles in 13 seconds (ot looks like I did some
mistakes
> in my previous time calculations - I have to recheck)
>
> =====================================
> Final Result = 13, Final Counter = 10000000000
> =====================================
>
> Here is the C++ code for the last test:
>
> #include "stdafx.h"
> #include <time.h>
>
> static long ArrayTimeLocal(long lngLoopMax, long& lngTotalCnt, bool
> useTracePrinting = false);
> int _tmain(int argc, _TCHAR* argv[])
> {
> _int64 lngTotalCnt = 0;
> long lngCnt = 0;
> time_t /*double*/ dblStart;
> time_t /*double*/ dblStop;
> long lngSeconds = 0;
>
> time(&dblStart);
> for (int i=1; i<=10; i++) {
> ArrayTimeLocal(10000000, lngCnt);
> lngTotalCnt += lngCnt;
> }
> time(&dblStop);
> lngSeconds = (long)difftime(dblStop,dblStart);;
> printf("Final Result = %ld, Final Counter = %I64d\n",
> lngSeconds, lngTotalCnt);
> }
>
> static long ArrayTimeLocal(long lngLoopMax, long& lngTotalCnt, bool
> useTracePrinting) {
> const long lngItems = 100;
> long alngTmp[lngItems][2];
> long lngLoop;
> long lngItem;
> long lngResult = 0;
> time_t /*double*/ dblStart;
> time_t /*double*/ dblStop;
> long lngSeconds;
> long lngCnt = 0;
>
> if (useTracePrinting) printf("Array looping test started..\n");
> time(&dblStart);
> for (lngLoop=0; lngLoop < lngLoopMax; lngLoop++) {
> for (lngItem=0; lngItem < lngItems; lngItem++) {
> alngTmp[lngItem][0] = lngLoop * 10;
> if (alngTmp[lngItem][0] / 10 == 100) lngResult = 1;
> else lngResult = 0;
> lngCnt++;
> }
> }
> time(&dblStop);
> if (useTracePrinting) printf("Array looping test ended.\n");
> lngSeconds = (long)difftime(dblStop,dblStart);;
> if (useTracePrinting) printf("Result = %lf, Counter = %ld\n",
> lngSeconds, lngTotalCnt);
> lngTotalCnt = lngCnt;
> return lngSeconds;
> }
>
> I will try to move now all variable from stack to static memory - I expect
> it may bring even more speed execution gains. We will see.
>
> As soon as you define your final call interface I will make a test C++
> .dll...
>
> Shamil
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com