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

Re: [amibroker] Re: AFL Question.



PureBytes Links

Trading Reference Links

Hello,

AFL in 4.30.0 and all earlier versions was interpreted directly.

AFL in 4.31.0 and higher versions is first parsed and a tree structure is built
first. Tree holds encoded information about parameters/function calls etc.
Then a tree-walker executes actions descibed by this tree.

This design makes it much faster to execute loops and user-defined functions.
This is so because loop body and function body is parsed only ONCE
and can be executed many times without re-parsing.

This makes it 3-10x faster than Microsoft JScript and VBScript.

Example

The following formulas do 4 million iterations, each consisting of one multiplication, one sine calculation,
one addition and one assignment.

// NATIVE CODE - executes in 2 seconds on my Athlon XP 1700
"Native loop start " + Now();

x = 0;

for( i = 0; i < 4000; i++ )

for( j = 0; j < 1000; j++ )

x = x + sin(i*j);

"Native loop end " + Now();



// JSCRIPT CODE - executes in 10 seconds on my Athlon XP 1700

EnableScript("jscript");

"JScript loop start " + Now();

<%

y = 0;

for( i = 0; i < 4000; i++ )

for( j = 0; j < 1000; j++ )

y = y + Math.sin(i*j);

%>

"JScript loop end " + Now();



Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "Metasan" <mdhuang@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Thursday, July 03, 2003 4:48 PM
Subject: [amibroker] Re: AFL Question.


> --- In amibroker@xxxxxxxxxxxxxxx, "Michael.S.G." <OzFalcon@xxxx> 
> wrote:
> > 
> > Is AFL compiled when it is run in amibroker?
> > 
> > Thanks
> > Michael.
> 
> Maybe only TJ can answer this question. But I would guess that AFL is 
> a interpretation language. The AB engine is a very efficient and fast 
> interpreter. It can also be on-the-fly compilation, but I doubt that 
> based on how it behaves.
> 
> 
> 
> 
> Send BUG REPORTS to bugs@xxxxxxxxxxxxx
> Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
> -----------------------------------------
> Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> --------------------------------------------
> Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> 
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 
> 
> 
> 

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/ySSFAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

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