[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Re: Question about JScript/VBScript & DLL's...


  • Date: Mon, 08 Mar 2010 19:16:20 +0100
  • From: Tomasz Janeczko <groups@xxxxxxxxxxxxx>
  • Subject: Re: [amibroker] Re: Question about JScript/VBScript & DLL's...

PureBytes Links

Trading Reference Links



> 40-50ms for each array access
It should be written that each array element takes 1/BarCount part of total time.
TOTAL time (for half million bars) is 50 ms. So each array element access time using the loop is about 0.1 MICROsecond (0.0000001 sec).

Generally speaking AFL loops are quite fast.

The following code displays COMMENTARY that shows actual times spent per bar in both looping and native CPU code.

GetPerformanceCounter(1);
mycum =
0;
for (bar=1; bar<BarCount; bar++)
{
   mycum[bar] = bar;
}
t1 =
GetPerformanceCounter(1);
"Looping code time per bar [ms]" + t1/BarCount;

mycum =
Cum( 1 );

t2 =
GetPerformanceCounter(1);
"Array code time per bar [ms]" + t2/BarCount;

"Speed factor between CPU native code (Cum) and loop): " + t1/t2;

Best regards,
Tomasz Janeczko
amibroker.com


On 2010-03-08 16:50, jooleanlogic wrote:
For loops and array access, yes there is a significant speed difference in C.

Just think of it this way Sid,
your afl loop in a dll will take about as long as any other inbuilt afl function does.
If an MA call on your machine takes a few milliseconds, then that's roughly as long as your afl loop in a dll will take, depending of course on what you're doing in that loop.

To give you an idea, on my computer, the following simple afl code takes about 200ms on half a million bars. The equivalent Cum(1) call takes about 5ms.

mycum = 0;
for (bar=1; bar<BarCount; bar++){
	mycum[bar] = mycum[bar-1] + 1;
}

Going by the Amibroker profiler, it's roughly 100ms for the loop itself and 40-50ms for each array access. In C, the loop itself is virtually a non event of a few milliseconds, freeing up a couple of hundred ms for your actual code inside the loop.
This is why you should always try and use the built in functions and array arithmetic operators where possible.

Jules.


--- In amibroker@xxxxxxxxxxxxxxx, "Rob" <sidhartha70@xxx> wrote:
  
Hi,

Sorry if this is a silly question... but having come a long way with AFL and feeling like I can do pretty much everything I need to within AFL, I am now wondering about the use of JScipt/_vbscript_ and DLL's...

In what circumstances would one use JScipt/_vbscript_ or write a custom DLL...? What are the advantages to their use...?

If someone would be kind enough to just give me a brief outline I'd appreciate it...

TIA

    



------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    amibroker-digest@xxxxxxxxxxxxxxx 
    amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/


  


__._,_.___


**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___