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

Re: [amibroker] Re: NOT REALLY A BUG



PureBytes Links

Trading Reference Links

Dimitris,

The example was intented to show that implementation of AFL language contructs
(like loops) is very, very fast.
So using loops is not a problem at all.

Problems may start when _the_ _formula_ _you_ _put_ _inside_ the loop
is written in inefficient manner.
I already wrote about some basic techniques like moving invariants
out of loop plus using variables and calling functions once instead
of repetitive calling the same functions with same params over and over again. 
If such inefficient code is wrapped inside several nested loops it will
execute slowly no matter in what language is written. Even if you wrote it
in assembler (straight machine CPU code)

These are basic things covered in each and every
book on programming (i.e. they are language-independent, because
these are 'universal' programing rules not depending on particular language).

But thank you for your suggestion - I will think about writing some article
about good programming practices in next newsletter.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Friday, October 01, 2004 8:01 AM
Subject: [amibroker] Re: NOT REALLY A BUG


> Tomasz,
> Your example is a bit strange. AFL does not need 5sec for 10 million 
> iterations, it is not a global measure, the total time depends 
> strongly on the code. It will not be 5 sec if we use an MA instead of 
> the sin function, it will be 5min and the total time will be much 
> longer if a Plot statement is added inside the loop.
> It would help to write some basic "rules" for the execution time of 
> AFL loops [perhaps in some next newsletter] and some instructions how 
> to "optimize" AFL loops.
> Dimitris
> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxxx> 
> wrote:
>> Hello,
>> 
>> You should optimize your formula first so it does not ages to 
> execute.
>> 
>> If your formula takes more than 1 second to execute you probably
>> did something very weird or wrong because AFL itself including 
> loops are hyper fast.
>> 
>> For example TEN million iteration of sine function like this:
>> for(i=0;i<10000000;i++)
>> {
>>  x = sin(i);
>> }
>> 
>> Takes only five seconds, so it takes 0.5 microsecond per iteration 
> (including calculation
>> of trigonometric function).
>> 
>> (Note that if you want to try this code you would need to adjust 
> the endless loop detection
>> threshold level in Tools->Preferences->AFL to more than 10 million 
> loops, otherwise you will
>> get endless loop warning).
>> 
>> Best regards,
>> Tomasz Janeczko
>> amibroker.com
>> 
>> ----- Original Message ----- 
>> From: "s.carrasset" <s.carrasset@xxxx>
>> To: <amibroker@xxxxxxxxxxxxxxx>
>> Sent: Thursday, September 30, 2004 3:55 PM
>> Subject: [amibroker] NOT REALLY A BUG
>> 
>> 
>> > hello, Tomasz.
>> > 
>> > it can happens ( rarely ^_^) that I get a "displeasure" with 
> amibroker.
>> > where can I send it , here or support?
>> > for ex the last one:
>> > 
>> > if I write or paste a code with many loops  (with no error 
> inside)  like 
>> > the last one parabolic code of  Dimitri in message 71077.
>> > 
>> > Amibroker becomes very slow to open the symbol workspace even if 
> i close 
>> > the code's window on the  displayed  chart pane.
>> > 
>> > stephane
>> > 
>> > 
>> > 
>> > Check AmiBroker web page at:
>> > http://www.amibroker.com/
>> > 
>> > Check group FAQ at: 
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
>> > Yahoo! Groups Links
>> > 
>> > 
>> > 
>> > 
>> > 
>> >
>> 
>> [Non-text portions of this message have been removed]
> 
> 
> 
> 
> Check AmiBroker web page at:
> http://www.amibroker.com/
> 
> Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> Yahoo! Groups Links
> 
> 
> 
> 
> 
>


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

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

<*> 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/